https://github.com/inadarei/nodebootstrap-microservice
Microservice Template for NodeBootstrap
https://github.com/inadarei/nodebootstrap-microservice
Last synced: 6 months ago
JSON representation
Microservice Template for NodeBootstrap
- Host: GitHub
- URL: https://github.com/inadarei/nodebootstrap-microservice
- Owner: inadarei
- License: mit
- Created: 2020-11-23T04:31:56.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-08-14T18:06:03.000Z (about 3 years ago)
- Last Synced: 2025-04-23T22:53:46.299Z (6 months ago)
- Language: JavaScript
- Size: 320 KB
- Stars: 7
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nodebootstrap-microservice
[![Code Climate Badge][codeclimate-img]][codeclimate-url]
[![NodeSecurity Status][nsp-img]][nsp-url]A skeleton of a containerized microservice generated by [Node Bootstrap](http://nodebootstrap.io)
## Developing code in local workspace
**Please note:** we follow the philosophy of clean separation between "build"
and "run" stages.In the build stage, the `Dockerfile` is used to build the container image and
bring it to a state where it can be run by any execution environment (such as:
Swarm, Kubernetes, ECR, etc.) given that the environment will also contextualize
it using appropriate environmental variables.In the run stage execution environment runs the container image built by the
Dockerfile. For local development docker-compose.yml takes the role of the
executor. it is the simplest solution for the task and we prefer keeping things
simple, locally.Please note that in the local environment code hot-reloading is turned on, so
there is no need to restart the container as you develop code, just edit the
corresponding files and enjoy the experience!## Run/Stop container:
```
# run:
> make [start]# stop:
> make stop# clean rebuild:
> make clean
```Inspecting health of the containers:
```
> make ps
```## Monitoring Logs:
```
> make logs
```## Debugging
To shell into the container, simply run:
```
> make shell
```## Running tests:
```
> make test
```
Coverage reports are stored under `coverage` sub-folder.## Installing a new package
Installing a package (let's assume for package `maikai`):
```
make add package=maikai
```Install a package in dev-dependencies (let's assume for package `mocha`):
```
make add-dev package=mocha
```If you add a number of packages in package.json manually (e.g. on the host),
you generally want to run `make build` to rebuild the container or run
`make clean` to stop, rebuild and start.## Database Migrations (Currently: MySQL)
```
# Create migration:
> npm run migration-create
# e.g.:
> npm run migration-create create-users-table
# Run migrations:
> make migrate
```## Accessing the microservice:
http://localhost:5501/
## Running Automated Tests
Run: `make test`
## License
[MIT](LICENSE)
[codeclimate-img]: https://codeclimate.com/github/inadarei/nodebootstrap-microservice/badges/gpa.svg
[codeclimate-url]: https://codeclimate.com/github/inadarei/nodebootstrap-microservice
[nsp-img]: https://nodesecurity.io/orgs/inadarei-public/projects/d639c395-08dd-4297-aeb5-87fcfa08cd3c/badge
[nsp-url]: https://nodesecurity.io/orgs/inadarei-public/projects/d639c395-08dd-4297-aeb5-87fcfa08cd3c