Skip to content

Repository files navigation

NodeJS logo

Node API

Description

Node API is production ready and open source project in Node, Express and MongoDB

Documentation

Swagger Docs https://rest-api-node-413916.uc.r.appspot.com/docs/

Support

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

Servers

ServerDescriptionApi Url
App EngineRest API Node - Google Cloud Platformhttps://rest-api-node-413916.uc.r.appspot.com

Showcase

ApplicationCode (GitHub)Server
https://typescript-angular4.herokuapp.com/https://github.com/renanlopescoder/typescript-angular4staging
http://mobx-react.herokuapp.com/https://github.com/renanlopescoder/mobx-reactstaging
http://vue-clash.herokuapp.com/https://github.com/renanlopescoder/vuestaging

Routes

Projects

URLCollectionMethodParametersResponseAction
https://rest-api-node-413916.uc.r.appspot.com/projectsprojectsgetNothingJSON with ArrayGet a list of projects in the database
https://rest-api-node-413916.uc.r.appspot.com/projects/createprojectspostJSONJSONAdd JSON into the database
https://rest-api-node-413916.uc.r.appspot.com/projects/update/:idprojectsputid, JSONUpdate the document with sent JSON data
https://rest-api-node-413916.uc.r.appspot.com/projects/select/:idprojectsgetidJSONReturn the document, related to the sent id
https://rest-api-node-413916.uc.r.appspot.com/projects/delete/:idprojectsdeleteidstatus 200Delete the document, related to the sent id

Users

URLCollectionMethodParametersResponseAction
https://rest-api-node-413916.uc.r.appspot.com/usersusersgetNothingJSON with ArrayGet a list of users in the database
https://rest-api-node-413916.uc.r.appspot.com/users/createuserspostJSONJSONAdd JSON into the database
https://rest-api-node-413916.uc.r.appspot.com/users/update/:idusersputidJSONUpdate the document with sent JSON data
https://rest-api-node-413916.uc.r.appspot.com/users/select/:idusersgetidJSONReturn the document, related to the sent id
https://rest-api-node-413916.uc.r.appspot.com/users/delete/:idusersdeleteidstatus 200Delete the document, related to the sent id

Collections

Schema Project (projects)

NameDescriptionType
projectproject nameString
technologiesproject technologiesString
descriptionproject descriptionString
demoLinkdemo linkString
githubLinkGitHub linkString
authorauthor's nameString
authorLinklinks to author (website, linkedin)String
projectproject nameString
statusproject status (Development / Production)String

Schema User (users)

NameDescriptionType
usernameuser nameString
passworduser password (hash)String
emailuser mailString
photouser photoString
nicknameuser nicknameString

API

TechnologyDescriptionLink
AppEngineGoogle Cloud Platform[cloud.google.com]
MongoDB AtlasMongoDB database servermongodb.com
GitHubVersion Controllinggithub.com

API Directories

  • 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

Configuring the API locally

  • 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

API Dependencies

By: Renan Lopes

Releases

Packages

Used by

Contributors

Languages