-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
30 lines (22 loc) · 1 KB
/
index.ts
File metadata and controls
30 lines (22 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// public imports
import * as dotenv from "dotenv";
import express, { Request, Response } from "express";
import boilerplate from "./boilerplate";
// Authress token validation
import authressTokenValidation from './authressTokenValidation';
// Example Express route controllers
// Accounts Manages a customer account that users have access to
import AccountsController from './accounts/accountController';
// Resources Manages a specific resource in a customer account
import ExampleResourceController from './resourceManagement/exampleResourceController';
// Manage user roles for an account or specific resource
import UsersController from './users/usersController';
dotenv.config();
const app = express();
boilerplate.setup(app);
app.use(authressTokenValidation);
app.use('/accounts/:accountId/items', ExampleResourceController);
app.use('/accounts', AccountsController)
app.use('/accounts/:accountId/users', UsersController);
// Express requires error handlers to be at the end
boilerplate.addErrorHandlers(app);