Skip to content

Sample REST API service to coordinate vaccination records

License

Notifications You must be signed in to change notification settings

eromerv/vaccination-api

Repository files navigation

Vaccination API

Sample REST API service to coordinate vaccination records.

Table of Content


Description

REST API with CRUD functionality using NestJS, CQRS and typeORM.


Technology Stack

The core technology stack in this project is based on NestJS framework.

  • node: version 18.9.1
  • npm: version 8.19.1
  • nestjs: version 9.0.0

Database Dependencies

  • pg: PostgreSQL client for node.js.
  • @nestjs/typeorm: Object Relational Mapper (ORM) available for TypeScript.

For the complete list of dependencies refer to Package.json file.


Local Usage

In this section, you will see the tools required and steps to setup development environment for this project.

Installation

Download the Installer: https://nodejs.org/en/download/

  1. Verify the Node.js installation using terminal window and enter the following command:
node --version
  1. Clone the project repository
git clone git@github.com:eromerodev/vaccination-api.git
  1. Go into the project folder
cd vaccination-api
  1. Install project dependencies
npm i

Run Locally

Run Docker PostgreSQL

  1. Inside this project go to the docker/postgres folder
  2. Then run the following command:
# make sure you are inside docker/postgres folder
$ docker-compose up --build
  1. After the container is up and running you can visit http://localhost:5050 to login to pgAdmin.

pgAdmin Credentials

NOTE: the docker-compose automatically will create the database schema using the the db.sql file

Start the API

If the database is running you can start the project with the following command:

# development
$ npm run start:dev

Test

Unit testing is testing the smallest testable unit of an application.

# unit tests
$ npm run test

In this example we are gonna testing the signup use-case, where a user is created successfully in the database.


Usage

The API is documented using the Swagger OpenAPI Specification.

http://localhost:3000/api

Insomnia

Also you can download an insomnia collection to import it into your local environment.


License

MIT


Happy Hacking!😎