Initial auth library commmit
This commit is contained in:
27
lib/app.ts
Normal file
27
lib/app.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import Koa from 'koa';
|
||||
import bodyParser from 'koa-bodyparser';
|
||||
import cookie from 'koa-cookie';
|
||||
import passport from 'koa-passport';
|
||||
import session from 'koa-session';
|
||||
|
||||
import { performanceLogger, perfromanceTimer } from './middleware/performance';
|
||||
import { errorHandler } from './middleware/errorHandler';
|
||||
|
||||
const app: Koa = new Koa();
|
||||
|
||||
app.use(errorHandler);
|
||||
app.use(perfromanceTimer);
|
||||
app.use(performanceLogger);
|
||||
app.use(bodyParser());
|
||||
app.use(cookie());
|
||||
|
||||
app.keys = [process.env.SESSION_KEYS as string];
|
||||
app.use(session({}, app));
|
||||
|
||||
app.use(passport.initialize())
|
||||
app.use(passport.session())
|
||||
|
||||
// Application error logging.
|
||||
app.on('error', console.error);
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user