Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mongoose = require('mongoose');
- var Schema = mongoose.Schema;
- var UserSchema = new Schema({
- username: String,
- password: String
- });
- module.exports = mongoose.model('User', UserSchema);
- var mongoose = require('mongoose');
- var Schema = mongoose.Schema;
- var ChatroomSchema = new Schema({
- name: String,
- password: String,
- members: ???
- });
- module.exports = mongoose.model('Chatroom', ChatroomSchema);
- router.route('/chatroom')
- .post(function(req, res) {
- var chatroom = new Chatroom();
- chatroom.name = req.body.name;
- chatroom.password = encrypt(req.body.password,chatroom.name);
- chatroom.members = ???;
- chatroom.save(function(err) {
- if (err)
- res.send(err);
- res.json({ message: 'Chatroom created!' });
- });
- });
- members : {username:String}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement