Skip to content

Commit

Permalink
db test
Browse files Browse the repository at this point in the history
  • Loading branch information
cianclarke committed Jul 24, 2015
1 parent a9ad7b1 commit b6abc20
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions application.js
@@ -1,6 +1,6 @@
var mbaasApi = require('fh-mbaas-api');
var fh = require('fh-mbaas-api');
var express = require('express');
var mbaasExpress = mbaasApi.mbaasExpress();
var mbaasExpress = fh.mbaasExpress();
var cors = require('cors');

// list the endpoints which you want to make securable here
Expand Down Expand Up @@ -29,6 +29,32 @@ app.use('/hello', require('./lib/hello.js')());
app.get('/env', function(req, res){
return res.json(process.env);
});
app.get('/db', function(req, res){
return fh.db({
act : 'list',
type : 'test'
}, function(err, items){
if (err){
return res.status(500).json(err);
}
return res.json(items);
})
});

app.post('/db', function(req, res){
var fields = req.body || { test : true };
return fh.db({
act : 'create',
type : 'test',
fields : fields
}, function(err, items){
if (err){
return res.status(500).json(err);
}
return res.json(items);
})
});

// fhlint-end

// Important that this is last!
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -5,7 +5,7 @@
"body-parser": "~1.0.2",
"cors": "~2.2.0",
"express": "~4.0.0",
"fh-mbaas-api": "~4.9.0",
"fh-mbaas-api": "https://dl.dropboxusercontent.com/u/1268608/fh-mbaas-api-5.0.2.tar.gz",
"mocha": "^2.1.0",
"request": "~2.40.0"
},
Expand Down

0 comments on commit b6abc20

Please sign in to comment.