Skip to content

Latest commit

 

History

History
67 lines (43 loc) · 1.82 KB

README.md

File metadata and controls

67 lines (43 loc) · 1.82 KB

knextancy-example

This is a simple example of how to build a multi tenant REST API. Using knextancy with express and PostgreSQL database.

Basically it has examples for:

This is how your database is gonna look like:

The tenant is defined based in the request header x-client-id. So any request will need to include it to get it working properly.

Running the Service

With docker compose

# in case you have not installed the deps yet
docker-compose run --service-ports --rm local npm install

docker-compose run --service-ports --rm local

Locally

  • You will need to startup a PostgreSQL database

  • Configure some environment variables

    • DB_PORT tcp://host:port (example tcp://localhost:5432)
    • DB_USER
    • DB_PASSWORD
    • DB_DATABASE
# in case you have not installed yet
npm install

npm start

Running Tests

With docker compose

# in case you have not installed the deps yet
docker-compose run --rm test npm install

docker-compose run --rm test

Locally

The same configuration to running the service locally.

 # in case you have not installed the deps yet
npm install

npm test