Question: Java Script: Implement the routes required for the todos api specified on slide 5 of the Express Routing notes. Your routes should just return a

Java Script:

Implement the routes required for the todos api specified on slide 5 of the Express Routing notes. Your routes should just return a status code and a simple message like the route on slide 8. You should also include the body-parser configuration.

This is what I have so far:

'use strict'

?var express = require('express'),

router = express.Router();

?module.exports = function (app, config) {

app.use('/api', router);

router.route(/todos').get(function(req, res, next){

console.log('Get all todos);

res.status(200).json({message: 'All ToDos'});

});

?};

app.use(express.static(path.normalize(__dirname) + '/public'));

?let routes = require('./routes')(app);

?app.use(function(req, res){

res.type('text/plan');

res.status(404);

res.send('404 Not Found');

});

Slide 5:

Java Script: Implement the routes required for the todos api specified on

Slide 8:

slide 5 of the Express Routing notes. Your routes should just return

Thank you.

ToDos AP URL /api/todos /api/todos/:id /api/todos /api/todos/:todo /api/todos/:todo Method GET GET POST PUT DELETE Function Get all todos Get todo with id id Create a todo Update todo Delete todo ToDos AP URL /api/todos /api/todos/:id /api/todos /api/todos/:todo /api/todos/:todo Method GET GET POST PUT DELETE Function Get all todos Get todo with id id Create a todo Update todo Delete todo

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!