This is a proof-of-concept (POC), multi-tenant RESTful Web Services application built on top of NodeJS.
- Install dependencies.
npm install
- Verify the Database configuration in
config/config.json
. - Create DB using Sequelize.
npx sequelize-cli db:create
- Run migrations on the main database.
npx sequelize-cli db:migrate
- Start the application.
npm start
- Perform API requests.
- For APIs other than
Signup
andAuthentication
, pass theJWT Token
in theAuthorization
header of the request.
Authorization: Bearer <JWT Token>
- For APIs other than
Signup
, pass theTenant ID
in theX-TENANT-ID
custom header of the request.
X-TENANT-ID: <Tenant ID>
- POST
/api/v1/accounts/signup
{
"name": "Alphabet",
"domain": "alphabet.com",
"firstName": "John",
"lastName": "Doe",
"email": "johndoe@alphabet.com",
"password": "5f4dcc3b5aa765d61d8327deb882cf99"
}
- POST
/api/v1/auth/login
{
"email": "johndoe@google.com",
"password": "5f4dcc3b5aa765d61d8327deb882cf99"
}
-
GET
/api/v1/organizations
-
GET
/api/v1/organizations/:organizationId
-
POST
/api/v1/organizations
{
"name": "Google",
"domain": "google.com"
}
- DELETE
/api/v1/organizations/:organizationId
-
GET
/api/v1/users
-
GET
/api/v1/users/:userId
-
POST
/api/v1/users
{
"firstName": "John",
"lastName": "Doe",
"email": "johndoe@google.com",
"password": "5f4dcc3b5aa765d61d8327deb882cf99"
}
- DELETE
/api/v1/users/:userId