I have a website which having front end and back end. I have stored my front end files in client folder. and back end files in admin folder. I have removed # tag from front end url.
by adding
$locationProvider.html5Mode(true);
in my client app.js file
and
<base href="/">
added in client index.html file
Same thing I added in admin folder file also in index.html I added
<base href="/admin">
but still its not working
here is my server.js file
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var path = require('path');
var session = require('express-session');
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/edb');
app.all('/', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next()
});
app.use(session({secret: 'keyboard cat', cookie: { maxAge: 60000 }, resave: true, saveUninitialized: true }))
app.use('/', express.static('app', { redirect: false }));
app.get('/', function (req, res, next) {
res.sendFile(path.resolve('client/index.html'));
});
I have tried adding this at the server.js file
app.get('/admin', function (req, res, next) {
res.sendFile(path.resolve('admin/index.html'));
});
but its taking to clent index.html file
Please give me a solution
thank you
via Athi
No comments:
Post a Comment