【发布时间】:2017-06-16 10:38:09
【问题描述】:
我正在使用使用 Parse-Server 的 back4app BaaS 服务。对于客户端,我使用 html5Mode(true); 运行 AngularJS;
我的问题是这不起作用:http://app.rizop.tv/dashboard 虽然这工作正常:http://app.rizop.tv
知道如何修复 expressJS 以正确处理我的路线吗?
我有这个配置:
cloud\app.js
// Helper modules that will be used
var path = require('path');
var bodyParser = require('body-parser')
// This imports the Router that uses the template engine
var index = require('./routers/index');
// Sets the template engine as EJS
app.set('view engine', 'ejs');
// This defines that the 'views' folder contains the templates
app.set('views', path.join(__dirname, '/views'));
// These options are necessary to
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
// This bind the Router to the / route
app.use('/', index)
// Starts listening in the routes
app.listen();
云\路由器\index.js
// Importing express
var express = require('express');
// Creating a Router
var route = express.Router();
// Defining a route that binds the GET method
route.get('/', function(req, res) {
// This is the code that renders the template
res.render('index', {testParam: 'Back4Apper'});
});
module.exports = route;
云\views\index.ejs
<!doctype html>
<html>
<head>
<meta charset="utf-8">
...
</body>
...
</body>
</html>
这是我的应用结构:
【问题讨论】:
标签: javascript angularjs express parse-server back4app