Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed external Mongoose Model #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
20 changes: 0 additions & 20 deletions README

This file was deleted.

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## node.js - TODO LIST

![status](http://b.repl.ca/v1/status-experiment-yellow.png "status")


*WORK IN PROGRESS*


#### Usage

```
foreman start
```

#### Routes

* list = lists the to do note entries and presents user with form for input of todo entry
* add = adds the entry to the db
* remove = removes a specific entry from the db


#### Next improvements

- [ ] refactor code
- [x] cleanup code
- [x] fix routing
- [x] fix mongoose model
- [ ] improve integration with mongodb
- [ ] add jinja support
12 changes: 0 additions & 12 deletions model.js

This file was deleted.

56 changes: 0 additions & 56 deletions mongoose.js

This file was deleted.

Empty file modified package.json
100644 → 100755
Empty file.
111 changes: 0 additions & 111 deletions requestHandlers.js

This file was deleted.

13 changes: 0 additions & 13 deletions router.js

This file was deleted.

17 changes: 0 additions & 17 deletions server.js

This file was deleted.

0 Procfile → todo-app/Procfile
100644 → 100755
File renamed without changes.
8 changes: 4 additions & 4 deletions index.js → todo-app/index.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ var router = require("./router");
var requestHandlers = require("./requestHandlers");

var handle = {}
handle["/"] = requestHandlers.list;
handle["/list"] = requestHandlers.list;
handle["/add"] = requestHandlers.add;
handle["/"] = requestHandlers.list;
handle["/list"] = requestHandlers.list;
handle["/add"] = requestHandlers.add;
handle["/remove"] = requestHandlers.remove;

server.start(router.route, handle);
server.start(router.route, handle);
14 changes: 14 additions & 0 deletions todo-app/model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var toDoSchema = new Schema({
title : String,
});

mongoose.connect('mongodb://127.0.0.1:27017/todo');
mongoose.model('todo', toDoSchema);

var toDo = mongoose.model('todo');


exports.toDo = toDo;
Loading