Skip to content

Commit

Permalink
Merge pull request #200 from bcgov/feature/email
Browse files Browse the repository at this point in the history
Send invite in email notification
  • Loading branch information
norrisng-bc authored May 21, 2024
2 parents c401e46 + 66c8431 commit 57fc13b
Show file tree
Hide file tree
Showing 20 changed files with 895 additions and 58 deletions.
13 changes: 13 additions & 0 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import { join } from 'path';
// @ts-expect-error 7016 api-problem lacks a defined interface; code still works fine
import Problem from 'api-problem';
import querystring from 'querystring';
import { rateLimit } from 'express-rate-limit';

import { name as appName, version as appVersion } from './package.json';
import { DEFAULTCORS } from './src/components/constants';
import { getLogger, httpLogger } from './src/components/log';
import { getGitRevision, readIdpList } from './src/components/utils';
import v1Router from './src/routes/v1';

import type { Request, Response } from 'express';

Expand Down Expand Up @@ -44,6 +46,14 @@ app.use(
})
);

// rate limiting applied to all routes.
// Current limit: 1000 requests/minute
const limiter = rateLimit({
windowMs: 60 * 1000,
max: 1000,
});
app.use(limiter);

// Skip if running tests
if (process.env.NODE_ENV !== 'test') {
app.use(httpLogger);
Expand Down Expand Up @@ -92,6 +102,9 @@ appRouter.get('/api', (_req: Request, res: Response): void => {
}
});

// v1 Router
appRouter.use(config.get('server.apiPath'), v1Router);

// Host the static frontend assets
// This route assumes being executed from '/sbin'
appRouter.use('/', express.static(join(__dirname, '../dist')));
Expand Down
Loading

0 comments on commit 57fc13b

Please sign in to comment.