Skip to content
Permalink
Browse files

GET /todos

  • Loading branch information
amejiarosario committed Oct 2, 2014
1 parent afc9080 commit 54ab912ea9aa2b6633ae12816beb6e6c3d2702e6
Showing with 17 additions and 11 deletions.
  1. +2 −2 app.js
  2. +15 −0 routes/todos.js
  3. +0 −9 routes/users.js
4 app.js
@@ -6,7 +6,7 @@ var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var routes = require('./routes/index');
var users = require('./routes/users');
var todos = require('./routes/todos');

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/todoApp', function(err) {
@@ -32,7 +32,7 @@ app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', routes);
app.use('/users', users);
app.use('/todos', todos);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
@@ -0,0 +1,15 @@
var express = require('express');
var router = express.Router();

var mongoose = require('mongoose');
var Todo = require('../models/Todo.js');

/* GET /todos listing. */
router.get('/', function(req, res, next) {
Todo.find(function (err, todos) {
if (err) return next(err);
res.json(todos);
});
});

module.exports = router;

This file was deleted.

2 comments on commit 54ab912

@selbekk

This comment has been minimized.

Copy link

selbekk replied Feb 5, 2015

Why do you still include mongoose in this file?

@amejiarosario

This comment has been minimized.

Copy link
Owner Author

amejiarosario replied Aug 6, 2016

@selbekk removed!

Please sign in to comment.
You can’t perform that action at this time.