# northwind-rest-api

> Local REST API Exposing 'Northwind Traders' Database.

Latest version **1.0.3** (published 2026-06-23) · 0 weekly downloads

## Install

```sh
npm install northwind-rest-api
pnpm add northwind-rest-api
yarn add northwind-rest-api
bun add northwind-rest-api
```

Provides the command `northwind`.

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2026-06-23 |
| First published | 2023-08-30 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 3.4 MB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| Author | Assaf Finkelshtein |
| Maintainers | assaf.fink |
| Keywords | northwind, northwind traders, backend, back end, back-end, mock, mockup, rest, rest api, restful, restful service, products, employees, suppliers, categories |

## Links

- npm: https://www.npmjs.com/package/northwind-rest-api
- npm.io page: https://npm.io/package/northwind-rest-api

## Dependencies (6)

- [joi](https://npm.io/package/joi.md) ^17.3.0
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1
- [express-fileupload](https://npm.io/package/express-fileupload.md) ^1.2.0

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [facebook-ads-library-api](https://npm.io/package/facebook-ads-library-api.md) — 0 weekly downloads
- [@comp-markdown/wireframe](https://npm.io/package/@comp-markdown/wireframe.md) — 0 weekly downloads
- [generador-datos-mx](https://npm.io/package/generador-datos-mx.md) — 0 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2026-06-23
- 1.0.2 — 2023-09-14
- 1.0.1 — 2023-08-30
- 1.0.0 — 2023-08-30

## README

# northwind-rest-api

A local REST API for Northwind database, containing products, employees, suppliers, categories, authentication and more. 

## Installation:

```bash
npm i -g northwind-rest-api
```
(You must install it globally using the ```-g``` flag so the backend could be started via command-line.)

## CLI Commands: 

- Run the REST API:
```bash
northwind  
```

- Display help: 
```bash
northwind --help 
```

- Display version: 
```bash
northwind --version
```

## Existing Users:
1. Admin User:
- Email: john.smith@gmail.com
- Password: 123456
2. Regular User:
- Email: mary.taylor@gmail.com
- Password: 123456

## Endpoints:

### Products:
- ```GET``` ```http://localhost:3030/api/products``` &rarr; Get all products.
- ```GET``` ```http://localhost:3030/api/products/7``` &rarr; Get product with id 7.
- ```POST``` ```http://localhost:3030/api/products``` &rarr; Add a new product.
- ```PUT``` ```http://localhost:3030/api/products/7``` &rarr; Update product with id 7.
- ```DELETE``` ```http://localhost:3030/api/products/7``` &rarr; Delete product with id 7.
- ```GET``` ```http://localhost:3030/api/products/images/01a5a6d5-6cc4-4e72-8f5d-e44efd3bc3d7.jpg``` &rarr; Get that product's image.
- ```GET``` ```http://localhost:3030/api/products/top-three``` &rarr; Get top three products (must be logged-in).
- ```GET``` ```http://localhost:3030/api/products/out-of-stock``` &rarr; Get out-of-stock products (must be admin).

### Employees:
- ```GET``` ```http://localhost:3030/api/employees``` &rarr; Get all employees.
- ```GET``` ```http://localhost:3030/api/employees/7``` &rarr; Get employee with id 7.
- ```POST``` ```http://localhost:3030/api/employees``` &rarr; Add a new employee.
- ```PUT``` ```http://localhost:3030/api/employees/7``` &rarr; Update employee with id 7.
- ```DELETE``` ```http://localhost:3030/api/employees/7``` &rarr; Delete employee with id 7.
- ```GET``` ```http://localhost:3030/api/employees/images/01a5f7d1-42e8-4f71-83c4-58e86751b272.jpg``` &rarr; Get that employee's image.

### Suppliers:
- ```GET``` ```http://localhost:3030/api/suppliers``` &rarr; Get all suppliers.
- ```GET``` ```http://localhost:3030/api/suppliers/7``` &rarr; Get supplier with id 7.
- ```POST``` ```http://localhost:3030/api/suppliers``` &rarr; Add a new supplier.
- ```PUT``` ```http://localhost:3030/api/suppliers/7``` &rarr; Update supplier with id 7.
- ```DELETE``` ```http://localhost:3030/api/suppliers/7``` &rarr; Delete supplier with id 7.
- ```GET``` ```http://localhost:3030/api/suppliers/images/01a57fe7-0f02-45e3-968b-65264020dd46.jpg``` &rarr; Get that supplier's image.

### Categories:
- ```GET``` ```http://localhost:3030/api/categories``` &rarr; Get all categories (must be logged-in).
- ```GET``` ```http://localhost:3030/api/categories/7``` &rarr; Get category with id 7 (must be logged-in).
- ```POST``` ```http://localhost:3030/api/categories``` &rarr; Add a new category (must be logged-in).
- ```PUT``` ```http://localhost:3030/api/categories/7``` &rarr; Update category with id 7 (must be logged-in).
- ```DELETE``` ```http://localhost:3030/api/categories/7``` &rarr; Delete category with id 7 (must be admin).
- ```GET``` ```http://localhost:3030/api/categories/images/01a1f85a-335e-4797-82b4-4c53d3aacb73.jpg``` &rarr; Get that category's image.

### Contact Us:
- ```POST``` ```http://localhost:3030/api/contact-us``` &rarr; Add a new contact-us message.
- ```GET``` ```http://localhost:3030/api/contact-us``` &rarr; Get all contact-us messages (must be admin).

### Auth:
- ```POST``` ```http://localhost:3030/api/register``` &rarr; Register as a new user.
- ```POST``` ```http://localhost:3030/api/login``` &rarr; Login as an existing user.
- ```POST``` ```http://localhost:3030/api/refresh-token``` &rarr; Get back a new token (must be logged-in).

## Slow Server Simulation:
For simulating a slow server you can precede each endpoint (besides image endpoints) with the word "delay".
This will cause a 3 seconds delay for that route.
This can help test how your frontend behaves when performing an http request to a slow server.

### Examples:
- ```GET``` ```http://localhost:3030/api/products``` &rarr; Gets all products without any delay.
- ```GET``` ```http://localhost:3030/delay/api/products``` &rarr; Gets all products after a 3 seconds delay.
- ```GET``` ```http://localhost:3030/api/employees/7``` &rarr; Gets employee with id 7 without any delay.
- ```GET``` ```http://localhost:3030/delay/api/employees/7``` &rarr; Gets employee with id 7 after a 3 seconds delay.
- ```POST``` ```http://localhost:3030/api/suppliers``` &rarr; Adds a new supplier without any delay.
- ```POST``` ```http://localhost:3030/delay/api/suppliers``` &rarr; Adds a new supplier after a 3 seconds delay.


## Entities:

### User: 
| Property   | Description       |
|------------|-------------------|
| id         | User's ID         |
| firstName  | User's first name |
| lastName   | User's last name  |
| email      | User's email      |
| password   | User's password   |
| role       | User's role       |

### Product: 
| Property   | Description                    |
|------------|--------------------------------|
| id         | Product's ID                   |
| name       | Product's name                 |
| price      | Product's price                |
| stock      | Available stock of the product |
| imageUrl   | URL of the product's image     |

### Employee: 
| Property   | Description                 |
|------------|-----------------------------|
| id         | Employee's ID               |
| firstName  | Employee's first name       |
| lastName   | Employee's last name        |
| title      | Employee's job title        |
| country    | Employee's country          |
| city       | Employee's city             |
| birthDate  | Employee's birth date       |
| imageUrl   | URL of the employee's image |

### Supplier: 
| Property   | Description                 |
|------------|-----------------------------|
| id         | Supplier's ID               |
| company    | Supplier's company name     |
| country    | Supplier's country          |
| city       | Supplier's city             |
| address    | Supplier's address          |
| phone      | Supplier's phone number     |
| imageUrl   | URL of the supplier's image |

### Category: 
| Property     | Description                 |
|--------------|-----------------------------|
| id           | Category's ID               |
| name         | Category's name             |
| description  | Description of the category |
| imageUrl     | URL of the category's image |

### Contact Us Message:
| Property   | Description             |
|------------|-------------------------|
| id         | Contact's ID            |
| name       | Contact's name          |
| email      | Contact's email address |
| phone      | Contact's phone number  |
| message    | Contact's message       |

---
_Source: https://npm.io/package/northwind-rest-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
