Use the Notion API to create a Quiz with JavaScript – SitePoint

Notion is a multi-featured app for organizing all sorts of content, from notes to calendars and reminders. In our last article, “Getting Started with the Notion API and Its JavaScript SDK”, we delved into how to use Notion’s API and created a small interface to interact with it. This article now will explore another use case for the Notion API: creating a JavaScript quiz.
While no previous knowledge is needed to follow along with this article (I’ll provide all the required steps), we’ll be dealing with front-end and back-end code, as there’s a bit of Node.js and Express setup involved, so some JavaScript skills are assumed.
JavaScript Quiz Project Setup
We’re going to split our setup into two sections. In the first one, we’ll walk through the required setup on the Notion side, and one the second part we’ll work with our code.
To follow along, you’ll need a Notion account (more on that below), as well as a recent copy of Node installed on your machine. As ever, the final code for the tutorial can be found on GitHub.
The Notion Setup
If you don’t already have a Notion account, please create one by following this link. After creating your account and logging in, create a new page by choosing Add a page and give it a name. For this tutorial, we’ll use a Table database. Although it’s not the ideal database to build a quiz, it’s the closest we can achieve with Notion!
Inserting information into the table
Now that we have our empty Table, we need to figure out how to properly insert our information into it.Our intended schema for our quiz is the following:
“1”: {
“Question”: “Which is the purpose of JavaScript?”,
“Answers”: {
“1”: “To style HTML Pages”,
“2”: “To add interactivity to HTML pages”,
“3”: “To perform server side scripting operations”
“Correct”: “To add interactivy to HTML pages”
“2”: {
“Question”: “To insert a JavaScript into an HTML page, which tag is used?”,
“Answers”: {
“1”: ““,
“2”: ““,
“3”: “

Leave a Reply