我对Express和Keystone非常陌生。一般来说,我想了解如何在Keystone中使用Express应用程序,即如何分解Express应用程序并将其导入Keystone,或者如何将Express模块与Keystone集成。更具体地说,作为开始,我想简单地使用Stormpath来验证我的用户。Stormpath提供了一个Express示例。我认为这是一个典型的简单Express应用程序,我如何将这个或类似的Express应用程序合并到Keystone中,即如何将其分解为Keystone中的相应部分和文件?
谢谢!
'use strict';
var express = require('express');
var stormpath = require('express-stormpath');
var routes = require('./lib/routes');
/**
* Create the Express application.
*/
var app = express();
/**
* Application settings.
*/
app.set('trust proxy',true);
app.set('view engine', 'jade');
app.set('views', './lib/views');
app.locals.siteName = 'Express-Stormpath Example Project';
/**
* Stormpath initialization.
*/
console.log('Initializing Stormpath');
app.use(stormpath.init(app, {
expand: {
customData: true} }));
/**
* Route initialization.
*/
app.use('/', routes);
app.on('stormpath.ready',function () {
console.log('Stormpath Ready');
});
/**
* Start the web server.
*/
var port = process.env.PORT || 3000;
app.listen(port, function () {
console.log('Server listening on http://localhost:' + port);});
发布于 2016-04-17 06:45:33
不幸的是,由于其加载方式的原因,快速风暴路径不能与Keystone.js一起工作=/
注意:我是express-stormpath库的原始作者,这就是我非常熟悉它的原因。
https://stackoverflow.com/questions/36667917
复制相似问题