I am currently utilizing the back4app BaaS service which operates on Parse-Server. On the ClientSide, I have integrated AngularJS with html5Mode set to true;
The issue I am facing is that this link is not functioning as expected: However, this link works perfectly fine:
Does anyone have any suggestions on how to adjust expressJS in order to correctly handle my routes?
This is the configuration I currently have:
cloud\app.js
// Necessary helper modules
var path = require('path');
var bodyParser = require('body-parser')
// Importing the Router which uses the template engine
var index = require('./routers/index');
// Setting EJS as the template engine
app.set('view engine', 'ejs');
// Specifying that the 'views' folder contains the templates
app.set('views', path.join(__dirname, '/views'));
// Required options
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
// Binding the Router to the / route
app.use('/', index)
// Listening to the routes
app.listen();
cloud\routers\index.js
// Importing express
var express = require('express');
// Creating a Router
var route = express.Router();
// Defining a route using the GET method
route.get('/', function(req, res) {
// Rendering the template
res.render('index', {testParam: 'Back4Apper'});
});
module.exports = route;
cloud\views\index.ejs
<!doctype html>
<html>
<head>
<meta charset="utf-8">
...
</body>
...
</body>
</html>
Here is the structure of my app: