yarn start 运行 steedos-server

This commit is contained in:
庄建国 2020-02-07 14:41:42 +08:00
parent 394a2cb709
commit bdb33d06a9
3 changed files with 46 additions and 2 deletions

View File

@ -13,7 +13,8 @@
],
"license": "MIT",
"scripts": {
"start": "cross-env NODE_ENV=development nodemon -w src -x ts-node server.ts",
"start": "cross-env NODE_ENV=development nodemon -w src -x ts-node steedos-server.ts",
"server": "cross-env NODE_ENV=development nodemon -w src -x ts-node server.ts",
"build": "tsc && yarn buildClient",
"buildClient": "cd webapp && yarn && yarn build && cd ..",
"prepare": "yarn build"
@ -35,19 +36,22 @@
"mem": "^5.1.1",
"mongoose": "5.6.6",
"nodemailer": "^6.3.0",
"oauth2-server": "^3.0.1",
"oauth2-server": "^2.4.1",
"redux-thunk": "^2.3.0",
"saml-idp": "^1.1.0",
"tslib": "1.10.0"
},
"devDependencies": {
"@steedos/meteor-bundle-runner": "^1.16.4",
"@steedos/objectql": "^1.16.2",
"@steedos/steedos-plugin-workflow": "^2.0.4",
"@types/dotenv-flow": "^3.0.0",
"@types/node": "12.6.8",
"cross-env": "^5.2.0",
"dotenv": "^8.2.0",
"dotenv-flow": "^3.1.0",
"nodemon": "1.19.1",
"steedos-server": "^1.16.4",
"ts-node": "8.3.0",
"typescript": "3.5.3"
},

View File

@ -0,0 +1,40 @@
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";
var server = require('@steedos/meteor-bundle-runner');
var steedos = require('@steedos/core')
server.Fiber(function () {
try {
server.Profile.run("Server startup", function () {
server.loadServerBundles();
steedos.init();
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}));
app.get('/', (req, res) => {
res.redirect("/accounts/a");
res.end();
});
init({app});
server.callStartupHooks();
server.runMain();
})
} catch (error) {
console.error(error.stack)
}
}).run()

Binary file not shown.