Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alesbe/node-restserver
Rest server made with NodeJS and MongoDB for a cafeteria
https://github.com/alesbe/node-restserver
jwt mongodb mongoose nodejs rest-api
Last synced: 5 days ago
JSON representation
Rest server made with NodeJS and MongoDB for a cafeteria
- Host: GitHub
- URL: https://github.com/alesbe/node-restserver
- Owner: alesbe
- License: gpl-3.0
- Created: 2020-07-29T16:40:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-01T22:51:52.000Z (almost 2 years ago)
- Last Synced: 2023-03-04T01:42:23.266Z (over 1 year ago)
- Topics: jwt, mongodb, mongoose, nodejs, rest-api
- Language: JavaScript
- Homepage:
- Size: 238 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# REST API: Cafeteria with NodeJS
REST server made with [NodeJS](https://nodejs.org/es/) and [MongoDB](https://www.mongodb.com/es).
**API documentation and info:** [Postman docs](https://web.postman.co/collections/7727126-fa15d799-b897-48d5-b197-95121ede80dc?version=latest&workspace=302ec022-de25-4482-842c-23cd7f984d58)
![example](https://i.imgur.com/6lYECCD.png)
REST API created as a project to simulate a cafeteria or restaurant. User management, categories, requests GET, POST, PUT, DELETE and PATCH and token user autentication.
## NPM packages used
- [**bcrypt**](https://www.npmjs.com/package/bcrypt): Password encryptation
- [**body-parser**](https://www.npmjs.com/package/body-parser): Take request parameters
- [**express**](https://www.npmjs.com/package/express): HTTP server
- [**express-fileupload**](https://www.npmjs.com/package/express-fileupload): Files upload
- [**google-auth-library**](https://www.npmjs.com/package/google-auth-library): Google authentication
- [**jsonwebtoken**](https://www.npmjs.com/package/jsonwebtoken): Token authentication
- [**mongoose**](https://www.npmjs.com/package/mongoose): MongoDB connection
- [**mongoose-unique-validator**](https://www.npmjs.com/package/mongoose-unique-validator): MongoDB validation
- [**underscore**](https://www.npmjs.com/package/underscore): Additional JS functionality## Features
- General features
- [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) for users, categories and products
- Role system for users
- [JWT](https://jwt.io/) token authentication and [Google OAuth](https://cloud.google.com/nodejs/getting-started/authenticate-users)
- Categories for each product
- Image upload- Security
- Password encryptation with [bcrypt](https://www.npmjs.com/package/bcrypt)
- URL protection with tokens
- Images saved in non-public folders
- Admin and users role system
- Validation system with [mongoose-unique-validator](https://www.npmjs.com/package/mongoose-unique-validator)
- Token seeds saved in server side
- Password protection to prevent being showed in clear text on JSON
- Category or product linked to the user that created it
- File extension validation
- Error capture returning an HTTP code
- Image URL protected with token## Install 🐳
I bundled the project in 2 docker containers, however **this project was made with learning purposes and is not maintained, do not use it in a real enviorment!**### Download the source code
Git clone the project or download the last version from [releases](https://github.com/alesbe/node-restserver/releases)### Run the containers
Cd into the project root folder, and do `docker-compose up`, this will pull the docker images and start them.By default, the backend server is running on port `8000`, and mongodb in port `27017`