Answer the question
In order to leave comments, you need to log in
How to make simple data output from external json?
Hi friends!
I'm trying to get into the frontend. I wrote a simple backend that, at the url mysite.com/api, gives json with a list of materials like:
[
{
"nid": "1",
"title": "My Title",
"field_image": "<img src="123.jpg">",
"body": "This is body"
},
{
"nid": "2",
...
var blogJSON = require('../blog.json');
exports.blog = function(req, res) {
res.render('blog', {
title: "Блог",
posts : posts
});
};
<% for (var i = 0; i < posts.length; i++) { %>
<%= posts[i].title %>
<% } %>
Answer the question
In order to leave comments, you need to log in
And with an external URL, this trick does not work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question