Sending JSON
Learn how to use Node.js, Express.js and Nunjucks to create dynamic web applications
Films array
let films = [
{ id: 'tt1825683', name: 'Black Panther' },
{ id: 'tt0203009', name: 'Moulin Rouge!' },
{ id: 'tt0446029', name: 'Scott Pilgrim vs. the World' },
{ id: 'tt1285016', name: 'The Social Network' },
{ id: 'tt2090440', name: 'Zombieland' }
];
GET /films Route Handler
app.get('/films', function(request, response) {
response.json(films);
});
Need help? Have questions? Join the Vonage Developer Community Slack and use the channel #onehack.