我正在使用 node.js 上的 express (3.0) 框架来路由我的应用程序。
我的大部分应用程序使用 http
协议,但有一个特定的路由我想只通过 https
来提供服务。这是我 API 的一部分,负责注册和验证用户。
例如:
app.get('/connect', function(req, res){
// Must be on HTTPS, if not redirect to HTTPS
});
app.post('/connect', function(req, res){
// Must be on HTTPS
});
app.get('/', function(req, res){
// Must be on HTTP
});
app.get('/build', function(req, res){
// Must be on HTTP
});
如何在同一个应用程序中同时使用两者?我很难找到任何实际示例。