Skip to content

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

Notifications You must be signed in to change notification settings

bravi-software/knextancy-example

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published