0
我正在Express中构建一个应用程序,但我希望它在S3启动之前在服务器启动前检索一些密钥。 Express可以吗?如果我谷歌我得到点击设置与Twitter Bootstrap快递。有没有办法启动一个Express应用程序?
我以前使用过Sails.js,你可以在bootstrap.js文件中指定bootstrap配置,所以我想我正在寻找类似的东西。否则有其他选择吗?
我有一个index.js文件和一个单独的bin/www文件,它调用index.js文件。我想在index.js中完成引导,这样它就成为测试的一部分。现在我初始化“的引导,但由于它是异步的服务器已经启动并运行之前,引导具有完全(或出错了),即
import express from 'express';
import {initializeFromS3} from './services/initializerService';
import healthCheckRouter from './routes/healthCheckRouter';
import bodyParser from 'body-parser';
initializeFromS3(); // Calls out to S3 and does some bootstrapping of configurations
const app = express();
app.use(bodyParser.json()); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
// ---------------------------- Routes ----------------------------
app.use('/', express.static('dist/client/'));
app.use('/health-check', healthCheckRouter);
export default app;