Use this file to discover all available pages before exploring further.
In this guide, you’ll learn how to set up and run a demo API built with Node.js. This demo API is part of a GitHub repository that contains several lesson folders, each demonstrating various Postman features through a simple API.
Before starting, ensure you have Node.js installed on your computer. If you haven’t installed it yet, please download the latest version (LTS or Current) from the official Node.js website.
The repository is organized into multiple lesson folders, each containing an index.js file that serves as the entry point for that lesson. Use the commands below to run the lessons on your local machine:
When you run Lesson Two, you will see output similar to:
Executing (default): SELECT 1+1 AS resultExecuting (default): DROP TABLE IF EXISTS `Users`;Executing (default): DROP TABLE IF EXISTS `Products`;Executing (default): PRAGMA foreign_keys = OFFExecuting (default): DROP TABLE IF EXISTS `Products`;Executing (default): DROP TABLE IF EXISTS `Users`;Executing (default): PRAGMA foreign_keys = ONExecuting (default): CREATE TABLE IF NOT EXISTS `Products` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255) NOT NULL UNIQUE, `price` FLOAT, `category` TEXT NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL);Executing (default): PRAGMA INDEX_LIST(`Products`);Executing (default): DROP TABLE IF EXISTS `Users`;Executing (default): CREATE TABLE IF NOT EXISTS `Users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `email` VARCHAR(255) NOT NULL UNIQUE, `password` VARCHAR(255) NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL);Executing (default): PRAGMA INDEX_LIST(`Users`);Connection has been established successfully.listening on port 4000
Once the API is running and listening on port 4000, it means your server is active on your local machine.
You can validate the functioning of the API by running:
curl localhost:4000
If the API is working correctly, you’ll receive a response indicating success.
To stop the API at any time, press Ctrl+C in the terminal. You can then run another lesson by executing its corresponding command.
By following these steps, you can easily set up and experiment with the Node.js demo API on your local environment. Enjoy exploring and learning about the API features across the various lessons!For more information on working with Node.js and APIs, you might find these resources helpful: