Skip to content

luizdesign/nodejs-api-skeleton

Repository files navigation

NodeJs API Skeleton

A simple skeleton to start projects using Node.js.

Pre Requirements

Structure

The Api have the structure below:

├── app/
│   ├── NamespaceProject (healthcheck example)  
│   │   ├── test/
│   │   ├── namespaceProject.controller.js
│   │   └── namespaceProject.router.js
│   └── index.js
├── Dockerfile
└── docker-compose.yml

Development

To start the development, clone the project, edit the files and run the project.

git clone git@github.com:luizdesign/nodejs-api-skeleton.git

Running

To run the project, execute the command:

docker-compose up

After it you can access http://localhost:3000/healthcheck/.

Rebuild Docker image

To rebuild the docker image, run the command below. It's necessary to build a new image with your changes.

docker-compose up --build

Or you can remove and create a new image:

docker images #returns all local docker images
docker rm $dockerImageName #remove the image named $dockerImageName
docker-compose up #recreate the image

Test

You can run some tests to ensure the code.

Integration Tests

Integration test access the api and check te return. To execute them, run the commands below.

# up the Api
docker-compose up

# run the integration test
docker-compose -f test.docker-compose.yml up

Contribute

You can contribute to improve the project by opening issues, and submitting pull requests. However check the issue list before to avoid duplicate issues.

Remember always on to check the contribution guide.