Skip to content

loge5/node-petstore-example

Repository files navigation

Example implementation of the openapi/swagger petstore

This is just an example for a node.js microservice using express.

Installation

# download required modules
npm install

# start service
npm start

Docker

It's also possible to run the service in a docker container.

# build
docker build -t petstore .

# run
docker run -d -p 3000:3000 petstore

API Documentation

  • We use OpenAPI Specification (swagger): https://www.openapis.org/
  • The specification is in this file: openapi.yaml
  • This project also includes swagger-ui wich is using the root-route (/index.html)

Unit-Tests

Used Modules:

# run tests
npm test

# check code coverage (creates "./coverage/index.html")
npm run-script cover

Development

Style Guide

We use this linter: https://github.com/standard/standard

Auto-Format:

npm run-script format

Commit Messages

We use standard-version, please format your commit messages like this:

<type>[optional scope]: <description>

[optional body]

[optional footer]

Types

  1. fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in semantic versioning).
  2. feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in semantic versioning).
  3. BREAKING CHANGE: a commit that has the text BREAKING CHANGE: at the beginning of its optional body or footer section introduces a breaking API change (correlating with MAJOR in semantic versioning). A BREAKING CHANGE can be part of commits of any type.
  4. Others: commit types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends chore, docs, style, refactor, perf, test, and others.

Releasing

For creating a new release, checkout the master branch and run:

npm run release

or for first:

npm run release -- --first-release

About

example of an node.js microservice

Resources

License

Stars

Watchers

Forks

Packages

No packages published