This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
tstatic/src/server.ts

21 lines
436 B
TypeScript
Raw Normal View History

import express from 'express';
import AccessControl from 'express-ip-access-control';
import { Options } from './types';
export default function createServer(opts : Options) {
const app = express();
if (opts.allowed_ips) {
app.set('trust proxy', true);
app.use(AccessControl({
mode: 'allow',
allows: opts.allowed_ips,
statusCode: 404
}));
}
2017-02-14 22:21:08 +00:00
return app;
}