Steps on how to use Notion as a database in your application

How could you use Notion as a database?

At any point set up a personal site where you display your most valuable tasks? Then, at that point, you probably know the pain of adding new undertakings to your HTML page. Eventually finding a spelling blunder in your text 2 days after putting it on the web…

Presently imagine storing all your messages, images, and whatever more on Notion. Changing anything you want on the go with the versatile app in no time. Significantly more important without changing any code or storing anything in your task records.

that’s the force of Notion…

This is the way you carry out it in 3 simple steps

Create your table with content in Notion

In the event that you haven’t already, create a Notion account on notion.com.

Presently we should create an integration so we can make use of the Notion API. As a matter of some importance, go to notion.com/my-integrations. and create another integration. Click submit and then make sure to duplicate the “internal integration token” and save it some place safe.

After that, we will create ourself another page and add another table to it. Select the option “new database”. And then set up your table headers and put in the data you want. In this example, I’m creating a database with all the books I suggest on my site.

Presently make sure to add the page with the new table to your new integration via the “add connection” tab while toggling the dropdown. This will enable you to access the table from the client we will set up in a later stage.

Install the NPM package

npm install @notionhq/client

This SDK is awesome and easiest way to use client for the Notion API.

Execute it into your code

After installing the package and configuring your database, you ought to now have the option to add the code that will recover everything from the table.

Do you recollect the “integration token” we had to save several minutes ago? We want it now! So make sure to create an environment record where you can store the variable that is holding the token. Then, at that point, use this code to initialize our client.

We made the connection, presently how about we capture all the gold! Awwwr… I mean our data.

Go to the page where your new table is available and duplicate the database id. Again store this id into an environment variable.

https://www.notion.so/{our-database-id}

Finally, we can question our database.

your return type will be a rundown, so mapping over it will be necessary. In the example beneath I will float over the book info and map it to another array that is easier readable than previously.

Et voila, you’ll have the option to access your Notion database data in no time! The following is what I did with the force of Notion’s API.

Conclusion

Heads up Notion isn’t a PostgreSQL server. Stunner!

Notion is ideal for usages where setting up a database would be pointless excess. For example, I used it to create my “book recommendation” section on my personal site.

The main parts are that it’s FREE, fast, and lightweight!

AUTHOR DETAILS :

Email rdatwani91@gmail.com
First Name Rashmi
Middle Name 
Last Name Chhabria
Phone7597464390   
Street Co Jayesh nagrecha, near dharNath temple, dharnath society ,Rajula
Citygujarat
CountryIndia
Occupationprivate  job
Materialsingle
Genderfemale
Birthdate29sep1985
NationalityIndia
Childrenno

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.