Answer the question
In order to leave comments, you need to log in
Setting up express + angular 2 routes?
Hello! I'm doing a project in Angular 2 + express. I can not properly configure routes on the server. The main page loads well; I turn to the internal, too, everything is fine. But when I reload the page, I get only data (json) without a front-end , this is how the route
setting
app.use(express.static(__dirname + '/../')); //getting the frontend, so the path is index.html
app.get('/place/info/1', function(req, res) {
res.json({
id: "df",
name: "name"
} );
});
what needs to be done to get the index for any routes and at the same time get your own json?
Thank you.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question