Tôi đang sử dụng dịch vụ back4app BaaS sử dụng Parse-Server. Đối với ClientSide tôi đang chạy AngularJS với html5Mode (true);cách giải quyết định tuyến ExpressJS khi sử dụng AngularJS html5Mode (back4app/Parse-Server)
Vấn đề của tôi là điều này là không làm việc: http://app.rizop.tv/dashboard Trong khi điều này đang làm việc phải: http://app.rizop.tv
Bất kỳ ý tưởng làm thế nào để sửa chữa expressJS để xử lý các tuyến đường của tôi một cách đúng đắn?
tôi có cấu hình này:
đám mây \ 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();
đám mây \ router \ 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;
đám mây \ xem \ index.ejs
<!doctype html>
<html>
<head>
<meta charset="utf-8">
...
</body>
...
</body>
</html>
Dưới đây là cấu trúc ứng dụng của tôi:
không, cùng lỗi: http://app.rizop.tv/dashboard. đã có. –
lito