更改节点服务器

更改节点服务器

问题描述:

的URL我刚刚部署使用节点与下面的脚本我的第一AngularJS应用的Heroku更改节点服务器

现在URL该网站是http://project.herokuapp.com/。不过,我希望它是http://project.herokuapp.com/beta。我怎样才能做到这一点?

var gzippo = require('gzippo'); 
var express = require('express'); 
var app = express(); 
  
app.use(gzippo.staticGzip("" + __dirname + "")); 
app.listen(process.env.PORT || 5000); 

随着快递(4x)Router()你可以做到这一点。例如:

// declare your router 
var router = express.Router(); 

// define your routes 
router.get('/', function(req, res) { 
    // do your stuff 
}); 

// define other routes and so on... 

// ...and make shure all your routes will be prefixed with /beta 
app.use('/beta', router); 

现在,http://project.herokuapp.com/beta是主要路径等航线将与/beta

始终前缀