This is a simple REST API built with Node.js that has zero dependencies. It demonstrates basic routing and HTTP methods
using the built-in http
module.
- Simple routing mechanism
- Supports GET, POST, PUT, DELETE, and PATCH HTTP methods
- Configurable server port via environment variables
- Lightweight and easy to understand
- Node.js (v12 or higher recommended)
-
Clone the repository:
git clone git@github.com:Roberto286/zero-dep-api.git cd zero_dep_node_api
-
(Optional) Create a
.env
file in the root directory and set the desired port:PORT=1234
Note that there's a default port (5687) in config.js file
The application uses the following environment variable:
PORT
: The port on which the server will listen. Default is5687
if not specified.
To start the server, run the following command:
npm start
The server will listen on the port specified in the .env
file or default to 5687
.