【发布时间】:2016-01-31 19:29:11
【问题描述】:
我是 node 和 express 的新手,但是当我在 windows azure 中托管我的 node web 应用程序时遇到了一个问题,顺便说一下,它在 localhost 上完全可以正常工作。我只是得到一个空白屏幕。
这是我的: server.js
var root = require('root');
var github = require('github-auth');
var express = require('express');
var path = require('path');
// var app = root();
var app = express();
var gh = github('clientid', 'clientsecret, {
organization: 'my-org',
team: 'my-team',
autologin: true // This automatically redirects you to github to login
});
app.get('/login', gh.login);
app.use(express.static(__dirname + '/'));
app.all('*', gh.authenticate);
app.all('*', function(req, res, next) {
if (!req.github) return res.sendFile(__dirname + '/login.html');
if (!req.github.authenticated) res.sendFile(path.join(__dirname+'/kickout.html'));
next();
});
app.get('/main',function(req,res){
res.sendFile(path.join(__dirname+'/main.html'));
});
app.get('/about',function(req,res){
res.sendFile('/kickout.html');
});
app.listen(3000);
console.log("Running at Port 3000");
【问题讨论】:
-
stackoverflow.com/questions/31011063/… 这对我一点帮助都没有
-
你应该检查部署是否完美,你能分享一下部署日志吗,这是你从kudublogs.msdn.com/b/benjaminperkins/archive/2014/04/01/…得到它的方式
-
您是在 WebRole 上还是在 Azure 应用服务 WebApp 上托管您的应用程序?
-
我将它托管在一个 azure WebApp 上
标签: node.js azure express deployment