steedos-platform/packages/accounts/steedos-server.ts

45 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-02-07 06:41:42 +00:00
require('dotenv-flow').config();
import * as express from 'express';
import * as hbs from 'hbs';
import * as path from 'path';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
import { init } from "./src";
2020-02-07 09:21:24 +00:00
import { isMeteor } from '@steedos/objectql';
const initConfig = require("@steedos/core/lib/init/init-config.json");
2020-02-07 06:41:42 +00:00
var server = require('@steedos/meteor-bundle-runner');
var steedos = require('@steedos/core')
2020-02-07 09:21:24 +00:00
declare var Meteor;
2020-02-07 06:41:42 +00:00
server.Fiber(function () {
try {
server.Profile.run("Server startup", function () {
server.loadServerBundles();
2022-07-06 07:56:34 +00:00
initConfig.built_in_plugins = []
2020-02-07 06:41:42 +00:00
steedos.init();
2020-02-07 09:21:24 +00:00
server.callStartupHooks();
2020-02-07 06:41:42 +00:00
const app = express();
app.engine('handlebars', hbs.__express);
app.set('views', __dirname + '/src/saml-idp/views');
app.set('view engine', 'hbs');
app.set('view options', { layout: 'layout' })
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors({origin: true, credentials: true}));
2020-02-07 09:21:24 +00:00
init({app: app, settings: Meteor.settings});
2020-02-07 06:41:42 +00:00
server.runMain();
})
} catch (error) {
console.error(error.stack)
}
}).run()