Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 1.5 KB

README.md

File metadata and controls

69 lines (46 loc) · 1.5 KB

Express Starting API

This is a basic Express application that serves as a starting point for building APIs using Express.js.

Prerequisites

Before getting started, make sure you have the following installed:

  • Node.js
  • npm (Node Package Manager)

Installation

  1. Clone this repository to your local machine.
  2. Navigate to the project directory.
  3. Run npm install to install the required dependencies.

Usage

To start the Express server, run the following command:

npm start

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

Tests

To test the API endpoints, you can use a tool like Postman or curl. Here are some example tests you can perform:

GET /api/register

  • Description: Get all users
  • Request:
    • Method: GET
    • URL: http://localhost:3000/api/register
  • Response:
    • Status: 200 OK
    • Body: Array of user objects

GET /api/login

  • Description: Get a specific user by ID
  • Request:
    • Method: GET
    • URL: http://localhost:3000/api/login/:id
      • Replace :id with the ID of the user you want to retrieve
  • Response:
    • Status: 200 OK
    • Body: User object

POST /api/logout

  • Description: Create a new user
  • Request:
    • Method: POST
    • URL: http://localhost:3000/api/logout
    • Body: User object (JSON)
  • Response:
    • Status: 201 Created
    • Body: Created user object

Feel free to modify and expand upon this starting API to suit your needs.