README
northwind-back-end
A local REST API for Northwind data, containing:
- Products including images
- Employees including images
- Categories including images
- Contact Us
- Register
- Login
Installation:
npm i -g northwind-back-end
(You must install it globally using the -g
flag so the backend could be started via cli command)
CLI Commands:
- Run the REST API:
northwind
- Display help:
northwind --help
- Display version:
northwind --version
The API
Products:
GET
http://localhost:3030/api/products
→ get all productsGET
http://localhost:3030/api/products/delayed
→ get all products with a 3sec delayGET
http://localhost:3030/api/products/7
→ get product #7GET
http://localhost:3030/api/products/delayed/7
→ get product #7 with a 3sec delayPOST
http://localhost:3030/api/products
→ add a new productPUT
http://localhost:3030/api/products/7
→ update product #7DELETE
http://localhost:3030/api/products/7
→ delete product #7GET
http://localhost:3030/api/products/images/7.jpg
→ get product #7's image
Employees:
GET
http://localhost:3030/api/employees
→ get all employeesGET
http://localhost:3030/api/employees/7
→ get employee #7POST
http://localhost:3030/api/employees
→ add a new employeePUT
http://localhost:3030/api/employees/7
→ update employee #7DELETE
http://localhost:3030/api/employees/7
→ delete employee #7GET
http://localhost:3030/api/employees/images/7.jpg
→ get employee #7's image
Categories:
GET
http://localhost:3030/api/categories
→ get all categoriesGET
http://localhost:3030/api/categories/7
→ get category #7POST
http://localhost:3030/api/categories
→ add a new categoryPUT
http://localhost:3030/api/categories/7
→ update category #7DELETE
http://localhost:3030/api/categories/7
→ delete category #7GET
http://localhost:3030/api/categories/images/7.jpg
→ get category #7's image- Note: for using the categories you must register or logged-in.
Contact Us:
GET
http://localhost:3030/api/contact-us
→ get all contact-us messagesPOST
http://localhost:3030/api/contact-us
→ add a new contact-us message
Auth:
POST
http://localhost:3030/api/auth/register
→ register as a new userPOST
http://localhost:3030/api/auth/login
→ login as an existing user