This API is build on NODE JS.
We need to set up a Node.js server. For this purpose, download and install it if you haven't already. you can download it from its's official website, Node.js.
If you don't know what is Node.js here is short description,
Node JS or Node is an Open Source and Cross Platform runtime environmennt for executing JavaScript code.
Supplemental reading on NODE-JS
- Create a directory of any name.
- Open it in your preferred code editor.
- Run the following commands in the project terminal to create package.JSON file:
npm init -yes
OR
npm init -y
Please update the scripts inside package.JSON file with the following:
"script": {
"start": "node index.js"
}
Run the following command in your project terminal to install Express in the project.
npm install express
OR
npm i express
Create an index.js file. Here we will write a book route
Please use the index.js file, I'm providing for you in this repository.
- First, we have imported Express into our file.
- We created an Express app by calling express().
- We created a route /book and attached a function to it. When the user makes a GET request to the route, the function will execute.
- Lastly, we run the Express app on a Port. in this case, it is 5005.
Run the following command in your project terminal to run the app.
npm start
You can use RapidAPI Client, a VS Code Extension to make a GET request to the API at endpoint: localhost:5005/book