Skip to content

About

Express REST API implementing user signup, duplicate validation, and user retrieval with documented Postman/curl tests.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

first-api-prototype

Express REST API implementing user signup, duplicate validation, and user retrieval with documented Postman/curl tests.

Backend API (Express)

A simple REST API built with Node.js and Express. It supports user signup, fetching users by ID, and a demo protected route.

Tech Stack

  • Node.js
  • Express
  • CORS
  • In-memory storage (no database yet)

Setup

  1. Install dependencies: npm install

  2. Start server: node server.js

Server runs on: http://localhost:8000


API Endpoints

1. Signup User

POST /signup

Creates a new user account.

Request Body (JSON): { "username": "triphon", "email": "[email protected]", "password": "1234" }

Success Response: 201 Created { "message": "User triphon registered successfully", "data": { "id": 1, "username": "triphon", "email": "[email protected]" } }

Errors:

  • 400 Missing fields
  • 409 Email already registered

2. Get User By ID

GET /users/:id

Example: GET http://localhost:8000/users/1

Response: { "id": 1, "username": "triphon", "email": "[email protected]", "createdAt": "2026-02-24T10:00:00.000Z" }

Errors:

  • 400 Invalid ID
  • 404 User not found

3. Secret Route

GET /secret?user=triphon

Returns a message only if username matches "triphon".


Testing

Using Postman

Using curl

curl -X POST http://localhost:8000/signup
-H "Content-Type: application/json"
-d "{"username":"triphon","email":"[email protected]","password":"1234"}"


Current Limitations

  • Users stored in memory (reset on server restart)
  • No real password hashing yet
  • No database persistence

Future: MongoDB / SQL integration

About

Express REST API implementing user signup, duplicate validation, and user retrieval with documented Postman/curl tests.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages