November 20, 2021

Creating your First CRUD Restful API with Node.JS and Hoppscotch

Welcome to Community Posts
Click below to read the full article.
Summary of What to Expect
Table of Contents
  1. Ensure you have Node.js installed on your computer.
  2. Create a new folder named "todo-list-backend" and open your command prompt or git bash.
  3. Run npm install --global yarn and then yarn init to initialize your Node.js project.
  4. Install necessary packages: yarn add express nodemon cors dotenv harperive.
  5. Create an index.js file and set up your Express server with basic routes.
  6. Create a HarperDB cloud instance and set up a database schema named "todos" and a table named "items" with a hash attribute "id".
  7. Create a dbconfig.js file to connect to the HarperDB cloud instance using the harperive package and dotenv to handle sensitive information.
  8. Implement CRUD operations:a. Create: Create a POST route to add new todo items to the database.b. Read: Create a GET route to retrieve all todo items from the database.c. Update: Create a POST route to update the todo status or content in the database.d. Delete: Create a POST route to delete a todo item from the database based on its id.
  9. Test your application using Hoppscotch.io to make API requests and verify the functionality of each route.