Skip to content
 
 

Repository files navigation

Express Products API Prototype

A learning-focused Express.js API prototype that demonstrates backend routing, query parameters, JSON data retrieval, static-file serving, and basic product endpoint design.

This repository originated from graduate coursework and is presented as a documented portfolio prototype.

Current Functionality

The application currently:

  • Starts an Express server on port 3000 by default
  • Serves static files from the public directory
  • Reads product records from a local JSON file
  • Lists products with pagination controls
  • Filters products by tag
  • Retrieves a single product by ID
  • Includes prototype create, update, and delete route handlers
  • Uses middleware for JSON request bodies and CORS support

API Endpoints

Method Endpoint Current behavior
GET / Serves the application home page
GET /products Returns products from the local JSON dataset
GET /products?offset=0&limit=25 Returns a paginated product list
GET /products?tag=<tag> Filters products by tag
GET /products/:id Returns one matching product
POST /products Prototype handler that returns the submitted request body
PUT /products/:id Prototype handler that returns the submitted changes
DELETE /products/:id Prototype handler that returns a success response

Technology

  • Node.js
  • Express.js
  • JavaScript
  • JSON
  • REST-style routing
  • Nodemon
  • CORS middleware

Project Structure

express-products-api-prototype/
├── app.js
├── api.js
├── products.js
├── middleware.js
├── package.json
├── index.html
├── data/
├── lib/
└── public/

Run Locally

  1. Clone the repository.
  2. Install the dependencies:
npm install
  1. Start the application:
npm start
  1. Open:
http://localhost:3000

Example Requests

List the first ten products:

GET /products?offset=0&limit=10

Filter by a product tag:

GET /products?tag=nature

Retrieve one product:

GET /products/<product-id>

Skills Demonstrated

  • Express server configuration
  • REST-style endpoint design
  • Route-handler organization
  • Asynchronous file operations
  • JSON parsing and filtering
  • Query-parameter handling
  • Pagination logic
  • Middleware integration
  • Basic error-path handling

Current Limitations

  • Product data is read from a local JSON file.
  • Create, update, and delete operations are prototype responses and do not persist changes.
  • MongoDB persistence is not implemented in the current code.
  • Automated tests are not currently configured.
  • Production authentication, validation, logging, and security controls are outside the project scope.

Possible Enhancements

  • Add persistent database storage
  • Validate incoming request data
  • Add structured error responses
  • Implement complete CRUD operations
  • Add automated API tests
  • Add API documentation with OpenAPI or Swagger

Responsible Portfolio Use

This repository contains coursework-based learning material and sample product data. It does not contain employer-confidential information, internal systems data, or real customer records.

Author

Jashvanthi Priyanka

LinkedIn

About

Express.js API prototype with JSON data retrieval, filtering, pagination, and REST-style product routes.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages