Node API is production ready and open source project in Node, Express and MongoDB
Swagger Docs https://rest-api-node-413916.uc.r.appspot.com/docs/
This application is hosted on Google Cloud Platfom and serve a bunch of AJAX requests to give and manipulate data from database and give a support to test front end applications
Server | Description | Api Url |
---|---|---|
App Engine | Rest API Node - Google Cloud Platform | https://rest-api-node-413916.uc.r.appspot.com |
URL | Collection | Method | Parameters | Response | Action |
---|---|---|---|---|---|
https://rest-api-node-413916.uc.r.appspot.com/projects | projects | get | Nothing | JSON with Array | Get a list of projects in the database |
https://rest-api-node-413916.uc.r.appspot.com/projects/create | projects | post | JSON | JSON | Add JSON into the database |
https://rest-api-node-413916.uc.r.appspot.com/projects/update/:id | projects | put | id, JSON | Update the document with sent JSON data | |
https://rest-api-node-413916.uc.r.appspot.com/projects/select/:id | projects | get | id | JSON | Return the document, related to the sent id |
https://rest-api-node-413916.uc.r.appspot.com/projects/delete/:id | projects | delete | id | status 200 | Delete the document, related to the sent id |
URL | Collection | Method | Parameters | Response | Action |
---|---|---|---|---|---|
https://rest-api-node-413916.uc.r.appspot.com/users | users | get | Nothing | JSON with Array | Get a list of users in the database |
https://rest-api-node-413916.uc.r.appspot.com/users/create | users | post | JSON | JSON | Add JSON into the database |
https://rest-api-node-413916.uc.r.appspot.com/users/update/:id | users | put | id | JSON | Update the document with sent JSON data |
https://rest-api-node-413916.uc.r.appspot.com/users/select/:id | users | get | id | JSON | Return the document, related to the sent id |
https://rest-api-node-413916.uc.r.appspot.com/users/delete/:id | users | delete | id | status 200 | Delete the document, related to the sent id |
Name | Description | Type |
---|---|---|
project | project name | String |
technologies | project technologies | String |
description | project description | String |
demoLink | demo link | String |
githubLink | GitHub link | String |
author | author's name | String |
authorLink | links to author (website, linkedin) | String |
project | project name | String |
status | project status (Development / Production) | String |
Name | Description | Type |
---|---|---|
username | user name | String |
password | user password (hash) | String |
user mail | String | |
photo | user photo | String |
nickname | user nickname | String |
Technology | Description | Link |
---|---|---|
AppEngine | Google Cloud Platform | [cloud.google.com] |
MongoDB Atlas | MongoDB database server | mongodb.com |
GitHub | Version Controlling | github.com |
- Public Routes
./src/routes/public
- Private Routes
./src/routes/private
- Models
./src/app/Models
- Controllers
./src/app/Controllers
- Services
./src/app/Services
- Config consign and express
./src/config/express.js
- Server configuration and application startup
./server.js
- Download or clone the project access the project folder with the terminal and execute the CLI
npm install
- Create your .env file with the following configuration
- WORKERS: How many workers you need
- AUTO_SCALE: When enabled will create workers by CPU Eg.: CPU * WORKERS
- DATABASE_URL: Your database URL
- AUTH_ROUNDS and AUTH_SECRET: Those are used for authentication and verification
WORKERS=1
AUTO_SCALE=true
DATABASE_URL=mongodb+srv://<user>:<password>@cluster0.mongodb.net/?retryWrites=true&w=majority
AUTH_ROUNDS=15
AUTH_SECRET=docssecret
- Run the server
npm start
- Access in your browser http://localhost:8080/projects
- For deployment is important to update app.yaml to your service_account and can be found on your GCP
- Dependency express - https://www.npmjs.com/package/express
- Dependency body-parser - https://www.npmjs.com/package/body-parser
- Dependency cors - https://www.npmjs.com/package/cors
- Dependency consign - https://www.npmjs.com/package/consign
- Dependency mongoose - https://www.npmjs.com/package/mongoose
By: Renan Lopes