Created
January 18, 2012 21:03
-
-
Save joshholt/1635644 to your computer and use it in GitHub Desktop.
Express Route DB Middle ware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('underscore'); | |
var insertRecord, fetchRecord, updateRecord, deleteRecord; | |
insertRecord = function(db, req) { | |
db[req.params.guid] = '{}'; | |
return "We have inserted a record for the instance represented by the GUID: " + req.params.guid; | |
}; | |
fetchRecord = function(db, req) { | |
return db[req.params.guid] | |
}; | |
updateRecord = function(db, req) { | |
db[req.params.guid] = JSON.stringify({config: _.extend(req.body, req.query)}); | |
return db[req.params.guid]; | |
}; | |
deleteRecord = function(db, req) { | |
delete db[req.params.guid]; | |
return "We have removed an instance for you using " + req.params.guid + " as the ID"; | |
}; | |
module.exports = { | |
createInstance: function(db) { }, | |
configureInstance: function(db) { }, | |
removeInstance: function(db) { }, | |
previewInstance: function(db) { }, | |
renderInstance: function(db) { } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment