https://github.com/ndrohith09/nodejs-restapi
https://github.com/ndrohith09/nodejs-restapi
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/ndrohith09/nodejs-restapi
- Owner: ndrohith09
- Created: 2023-03-08T15:49:35.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-04T08:23:47.000Z (about 2 years ago)
- Last Synced: 2025-02-01T01:31:33.809Z (3 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## Node JS Rest API
This is a simple Node JS Rest API that uses Express and MongoDB.
### Installation
Install the dependencies and devDependencies and start the server.
```sh
$ cd node-rest-api
$ npm install
$ npm start
```For production environments...
```sh
$ npm install --production
$ NODE_ENV=production node app
```### Docker
Node Rest API is very easy to install and deploy in a Docker container.
By default, the Docker will expose port 8080, so change this within the Dockerfile if necessary. When ready, simply use the Dockerfile to build the image.
```sh
cd node-rest-api
docker build -t /node-rest-api .
```This will create the node-rest-api image and pull in the necessary dependencies. Be sure to swap out with the name of the user you created in the previous step. Once done, run the Docker image and map the port to whatever you wish on your host. In this example, we simply map port 8080 of the host to port 8080 of the Docker (or whatever port was exposed in the Dockerfile):