我刚刚使用带有以下脚本的Node将我的第一个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);
借助Express(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
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句