Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a-m-dev/nodejs_simple_restful_api
Simple Standard NodeJs setup for Restful Api design
https://github.com/a-m-dev/nodejs_simple_restful_api
babel mongodb mongoose nodejs rest-api
Last synced: 23 days ago
JSON representation
Simple Standard NodeJs setup for Restful Api design
- Host: GitHub
- URL: https://github.com/a-m-dev/nodejs_simple_restful_api
- Owner: a-m-dev
- Created: 2020-03-21T01:19:05.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T02:42:40.000Z (over 1 year ago)
- Last Synced: 2024-05-27T21:49:52.215Z (8 months ago)
- Topics: babel, mongodb, mongoose, nodejs, rest-api
- Language: JavaScript
- Homepage:
- Size: 2.19 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nodejs_standard_setup
Simple Standard NodeJs setup for Restful Api design
### boot up
make sure that mongo is runing on your machine on port `27017` or also you can pull docker image of mongodb and use that. for starting the project just run `npm install` first and `npm run serve` to spin up that on port `:3010`.
### description
this is just a simple repo for you to see how nodejs basically sets up for a standard Restful API. in feature brances Jest will be added for testing. for now there are just couple of middlewares to handle a bit of error handeling and more importantly cors issues and response to `OPTIONS` method. also there is a resource called `author` that has controller as much as route and model.
### build
you are using ESM mosules in the entire project, which enabels you to use `import/export`, `async/await` and many more features of ES6 in this project, so , in order to transpile that to regular js you need to run `npm run build`; this command would create a `built` folder in root directory and actually you can create a docker file to spins up a node js with an nginx and runs the content of that folder and there we go, you got your backend system!
also notice that in `mongoConnect.js` remember to change the connection string when you build and want to deploy, any changes in the `docker-compose.yml` file in order to improve the usablity would be appritiated to send some pull request to me!