Skip to content

Instantly share code, notes, and snippets.

@inabahare
Last active April 13, 2016 10:09
Show Gist options
  • Save inabahare/131c6b8315515a27dd09fcf896dfb151 to your computer and use it in GitHub Desktop.
Save inabahare/131c6b8315515a27dd09fcf896dfb151 to your computer and use it in GitHub Desktop.
// ./app.js
[..]
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/kittens');
[..]
app.use('/', routes);
app.use('/find', find);
[..]
// ./models/books.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var Books = new Schema({
title: {type: String, required: true, unique: true},
description: {type: String, required: true},
cover: String,
});
module.exports = mongoose.model('Books', Books);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment