Skip to content

traycerai/api-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-demo

A RESTful API demo built with Express.js

Prerequisites

  • Node.js (v14 or higher)
  • npm (Node Package Manager)

Installation

  1. Clone the repository:
git clone <repository-url>
cd api-demo
  1. Install dependencies:
npm install

Available Scripts

  • npm start: Start the production server
  • npm run dev: Start the development server with nodemon
  • npm test: Run the test suite

Environment Variables

Create a .env file in the root directory with the following variables:

PORT=3000
NODE_ENV=development

API Endpoints

Health Check

  • URL: /health
  • Method: GET
  • Success Response:
    • Code: 200
    • Content: { "status": "OK", "message": "Server is healthy" }

Development

To run the server in development mode with hot-reload:

npm run dev

The server will start on http://localhost:3000

Testing

To run the test suite:

npm test

Curl to create user

 curl -X POST http://localhost:3000/api/users \
  -H "Content-Type: application/json" \
  -d '{"username": "dummy_user", "email": "[email protected]", "password": "dummy_password"}'

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published