steedos-platform/packages/accounts/server.ts

31 lines
787 B
TypeScript
Raw Normal View History

2020-02-07 05:29:22 +00:00
require('dotenv-flow').config();
2019-08-22 10:30:48 +00:00
import * as express from 'express';
2019-09-01 13:52:59 +00:00
import * as hbs from 'hbs';
2019-08-22 10:30:48 +00:00
import * as path from 'path';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
import { init } from "./src";
2019-08-22 10:30:48 +00:00
const app = express();
2019-09-01 13:52:59 +00:00
app.engine('handlebars', hbs.__express);
app.set('views', __dirname + '/src/saml-idp/views');
app.set('view engine', 'hbs');
app.set('view options', { layout: 'layout' })
2019-08-22 10:30:48 +00:00
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
2019-10-11 08:41:13 +00:00
app.use(cors({origin: true, credentials: true}));
2019-08-22 10:30:48 +00:00
2019-08-22 10:33:38 +00:00
app.get('/', (req, res) => {
2019-09-01 12:17:59 +00:00
res.redirect("/accounts/a");
2019-08-22 10:33:38 +00:00
res.end();
});
2019-08-30 02:56:58 +00:00
init({app});
2019-08-22 10:30:48 +00:00
const port = process.env.PORT ? process.env.PORT : 4000;
app.listen(port, () => {
console.log('Server listening on port ' + port);
2019-08-22 10:30:48 +00:00
});