Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasgabrieldeaa/node-api
https://github.com/lucasgabrieldeaa/node-api
es6 nodejs
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lucasgabrieldeaa/node-api
- Owner: lucasGabrielDeAA
- Created: 2019-02-19T20:54:17.000Z (over 5 years ago)
- Default Branch: staging
- Last Pushed: 2023-01-05T10:16:06.000Z (almost 2 years ago)
- Last Synced: 2023-08-05T02:41:11.606Z (over 1 year ago)
- Topics: es6, nodejs
- Language: JavaScript
- Size: 819 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NodeJS's API created for knowledge porpouses
# node-api
## Installing [NodeJS](https://nodejs.org/en/)
You should install NodeJS using a package manager, in the NodeJS's site, you have this option.
After installation, run the following command to check the version installed.
```
node -v
```To start a NodeJS API, run the following commands.
```
mkdir && cd
```The following command will generate the file's estructure of a API in the directory created and acessed above.
```
npm init -y
```## Preparing the environment
# Docker & MongoDb
Follow the installation steps according your platform, at the [Docker](https://docs.docker.com/install/) documentation. After docker's installation, you need to run a mondogb's rom in the docker's environment. And enable the docker port to listen to real port commands. Running the following command.
```
docker run --name -p 27017:27017 -d mongo
```To manage your mongoDB's environment, it's recomended to use the [Robo3T](https://robomongo.org/) software. Just download it, and run it, to connect it to yours mongo's docker rom.
Note: Remember to always run your mongo's rom before start Robo3T, for this, use the following command.
```
docker start
```After all, you just need to install, the application's dependencies.
```
yarn install
```## Executing the application
This application uses the [Nodemon](https://www.npmjs.com/package/nodemon) dependency, to run the application, you just need to run the following command to start the application, using nodemon to listen all the code's update.
```
yarn run dev
```## Accessing the application
To access the ```GET```'s requests, you can use the browser. But, to make ```POST, PUT, DELETE``` request you should use some software for this. I choose to use the [PostMan](https://www.getpostman.com/), but you can use your favorite software for this. Accessing the following url.
```
localhost:3001/api/products
```## Admin console
Create a **.env** file on project's root with the following content.
```
ADMIN_EMAIL="[email protected]"
ADMIN_PASSWORD="some-long-and-string-passowrd-with-alphanumerical-and-special-caracters"
```After all, you can access the admin console under the following url.
```
localhost:3001/admin
```