Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send invite in email notification #200

Merged
merged 7 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading