My personal Koa2 API startup kit, feel free to use and contribute if you like
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.env.example
.eslintrc.json
.gitignore
package.json
readme.md
yarn.lock

readme.md

Koa API Startup Kit

My personal Koa2 API startup kit, feel free to use and contribute if you like.

Prerequisites

Setup Development Environment

Create Config Files

Create an .env file based on the .env.example

  cp .env.example .env

Check and replace the environment variables in the new file.

Initialize Database

Here you can either choose to have and instance of Postgres installed locally in your machine or use a docker container.

Simple example of using Postgres through Docker:

  docker run -it -p 5432:5432 -e POSTGRES_USER='root' -e POSTGRES_PASSWORD='password' -e POSTGRES_DB='db_koa' postgres:10

Keep in mind that sample above don't generate a volume, so it wont persist the data after you stop your docker container.

Install dependencies

  yarn install

Migrate database

  yarn migrate

Starting App

  yarn dev

The server will be available in the port you set in the .env file

Tests

# Unit
yarn test

# Integration
yarn test:i

# Acceptance
yarn test:a

# All (Sequential)
yarn test:all

You need a database running with all migrations for the integration and acceptance tests

Todos

  • Docker compose infrastructure
  • CI/CD Jenkinks
  • Production environment

License

MIT