Permalink
Browse files

Added mongoose Schema

  • Loading branch information...
edubkendo committed Jun 25, 2012
1 parent 916effc commit 56a0e96562393cfd5c9b7464170791a9d0553251
Showing with 38 additions and 19 deletions.
  1. +20 −1 notes.md
  2. +8 −5 package.json
  3. +10 −13 server.coffee
View
@@ -4,4 +4,23 @@ npm install -g brunch
git clone git://github.com/icholy/ember-brunch.git -b coffee
-brunch new myapp -s ./ember-brunch/
+brunch new myapp -s ./ember-brunch/
+
+(or
+npm install -g brunch
+git clone ######
+npm install .
+brunch build
+)
+
+set up server.coffee to start our server with zappajs, and serve the public folder. We also go ahead and set up 'mongoose' to be our MongoDB adapter:
+
+```coffee
+require('zappajs') ->
+
+ mongoose = require 'mongoose'
+ db = mongoose.connect('mongodb://localhost/zapp_ember_database')
+
+ @use 'static'
+```
+
View
@@ -1,8 +1,8 @@
{
- "author": "Your Name",
- "name": "package-name",
- "description": "Package description",
+ "name": "zappa-ember-brunch",
"version": "0.0.1",
+ "author": "edubkendo",
+ "description": "An example app using zappa, brunch and ember with sockets",
"homepage": "",
"repository": {
"type": "git",
@@ -20,11 +20,14 @@
"css-brunch": "> 1.0 < 1.3",
"uglify-js-brunch": "> 1.0 < 1.3",
"clean-css-brunch": "> 1.0 < 1.3",
- "ember-handlebars-brunch": "git://github.com/icholy/ember-handlebars-brunch.git"
+ "ember-handlebars-brunch": "git://github.com/icholy/ember-handlebars-brunch.git",
+ "zappajs": "~0.3.9",
+ "mongoose": "~2.7.0"
},
"devDependencies": {
"mocha": "0.14.0",
"expect.js": "0.1.2",
- "express": "2.5.8"
+ "express": "2.5.8",
+ "chai": "~1.0.4"
}
}
View
@@ -1,18 +1,15 @@
-express = require 'express'
+require('zappajs') ->
-exports.startServer = (port, path, callback = (->)) ->
+ mongoose = require 'mongoose'
+ db = mongoose.connect('mongodb://localhost/zapp_ember_database')
- server = express.createServer()
+ Schema = mongoose.Schema
- server.configure ->
- server.use express.static path
- server.set 'views', path
- server.set 'view options', layout: no
- server.register '.html', compile: (str, options) ->
- (locals) -> str
+ ContactSchema = new Schema
+ firstName: String
+ lastName: String
- server.get '/', (req, res) ->
- res.render 'index.html'
+ Contact = mongoose.model('Contact', ContactSchema)
- server.listen parseInt port, 10
- server.on 'listening', callback
+
+ @use 'static'

0 comments on commit 56a0e96

Please sign in to comment.