Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Arquivo todoSchema.js
- const restful = require('node-restful')
- const mongoose = restful.mongoose
- const todoSchema = new mongoose.Schema({
- description: { type: String, required: true },
- done: { type: Boolean, required: true, default: false },
- createdAt: { type: Date, default: Date.now }
- })
- module.exports = todoSchema
- -- Arquivo todoService.js
- const restful = require("node-restful")
- const todoSchema = require('./todoSchema')
- const Todo = restful.model('Todo', todoSchema)
- Todo.methods(['get','post','put','delete'])
- Todo.updateOptions({new: true, runValidators: true})
- module.exports = Todo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement