Answer the question
In order to leave comments, you need to log in
How to send subrequests in express.js?
Hello!
I am building the first application on the MEAN stack, I made a simple CRUD-api, which on app.get () gives data from mongo db in json format.
Now I'm fastening the template engine and I can't understand the fundamental point:
here is the index page (no data yet).
app.get('/', function(req, res) {
res.render("index", {});
});
/api/backups
Answer the question
In order to leave comments, you need to log in
If /api/backups is located on the local machine, it is easier to make a function with a request to the database and process it when switching to index. If you want to get data with a request, then you can use the request package, for example
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question