का उपयोग करते समय ExpressJS रूटिंग को हल करने का तरीका मैं बैक 4app BaaS सेवा का उपयोग कर रहा हूं जो पार्स-सर्वर का उपयोग करता है। क्लाइंटसाइड के लिए मैं html5Mode (सत्य) के साथ AngularJS चला रहा हूं; http://app.rizop.tv/dashboard हालांकि यह सही काम कर रहा है: http://app.rizop.tvAngularJS html5Mode (back4app/parse-server)
किसी भी विचार कैसे सही तरीके से मेरी मार्गों को संभालने के लिए expressJS ठीक करने के लिए
मेरे समस्या यह है कि इस काम नहीं कर रहा है?
बादल \ 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();
बादल \ रूटर \
// 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;
बादल \ विचारों index.js \ index.ejs:
मैं इस config है
<!doctype html>
<html>
<head>
<meta charset="utf-8">
...
</body>
...
</body>
</html>
यहाँ मेरी एप्लिकेशन संरचना होती है:
नहीं, वही त्रुटि: http://app.rizop.tv/dashboard। पहले से ही है। –
lito