Skip to content

Commit

Permalink
Migrated shopping-cart to Express 4, began work on README
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Pruitt committed Jul 12, 2014
1 parent 527bae8 commit 8d6bef7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
14 changes: 14 additions & 0 deletions shopping-cart/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@

Notes:



To read more about the seneca-engage plugin, take a look at
https://github.com/rjrodger/seneca-engage

To read more about the shopping cart plugin, check out
https://github.com/rjrodger/seneca-cart

Feel free to contact me on Twitter if you have any questions! :) @rjrodger



Run with:

node app.js -p 3000
Expand Down
20 changes: 13 additions & 7 deletions shopping-cart/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

var http = require('http')

var express = require('express')
var express = require('express')
var bodyParser = require('body-parser')
var cookieParser = require('cookie-parser')
var methodOverride = require('method-override')
var session = require('express-session')
var serveStatic = require('serve-static')
var argv = require('optimist').argv


Expand All @@ -20,6 +25,7 @@ var seneca = require('seneca')()
// enable the /mem-store/dump HTTP end point
// this lets you see the entire contents of the database as a JSON object
// in the browser - very useful for debugging!
// Go to http://localhost:3333/mem-store/dump to debug db contents
seneca.use('mem-store',{web:{dump:true}})


Expand All @@ -39,13 +45,13 @@ seneca.use('cart')
var app = express()
app.enable('trust proxy')

app.use(express.cookieParser())
app.use(cookieParser())
app.use(express.query())
app.use(express.bodyParser())
app.use(express.methodOverride())
app.use(express.json())
app.use(bodyParser.urlencoded({extended: true}))
app.use(methodOverride())
app.use(bodyParser.json())

app.use(express.static(__dirname + '/public'))
app.use(serveStatic(__dirname + '/public'))

// expose the shopping cart api
// the seneca.export('web') method returns a single function with the signature
Expand All @@ -57,7 +63,7 @@ app.use(express.static(__dirname + '/public'))
app.use( seneca.export('web') )


// express views for the cart pags
// express views for the cart pages
app.engine('ejs',require('ejs-locals'))
app.set('views', __dirname + '/views')
app.set('view engine','ejs')
Expand Down
11 changes: 8 additions & 3 deletions shopping-cart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
"author": "Richard Rodger",
"license": "MIT",
"dependencies": {
"express": "~3.1.0",
"optimist": "~0.3.5",
"ejs": "~0.8.3",
"express": "~4.6.0",
"body-parser": "~1.4.3",
"cookie-parser": "~1.3.2",
"method-override": "~2.1.1",
"express-session": "~1.6.5",
"serve-static": "~1.3.2",
"optimist": "~0.6.1",
"ejs": "~1.0.0",
"ejs-locals": "~1.0.2",
"seneca": "~0.5.18",
"seneca-user": "~0.2.10",
Expand Down

0 comments on commit 8d6bef7

Please sign in to comment.