-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (44 loc) · 1.39 KB
/
index.js
File metadata and controls
56 lines (44 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
dbs = require('./config/databases')
mongode = require('mongode');
// Usage notes: https://github.com/philippkueng/node-neo4j
dbs.neo4j.InsertNode({
name: 'Darth Vader',
sex: 'male'
},function(err, node){
if(err) throw err;
// Output node properties.
console.log(node.data);
// Output node id.
console.log(node.id);
});
exports.getStoreLocation = function (companyId, locationId, response) {
var storeLocationCollection = dbs.mongo.collection('StoreLocation');
response.writeHead(200, { 'Content-Type': 'application/json' });
storeLocationCollection.findOne({$and: [{"CompanyId" : companyId},
{"LocationId" : locationId}]}, function(err, object) {
if(object != null)
{
response.write(JSON.stringify(object));
}
else
{
response.end();
}
});
}
//Demo Code
var flatiron = require('flatiron');
var beermenu = require('./beermenu');
app = flatiron.app;
app.use(flatiron.plugins.http);
beermenu.initialize();
app.router.get('/storelocation/:companyId/:locationId', function (companyId, locationId) {
beermenu.getStoreLocation(companyId, locationId, this.res);
});
app.router.get('/menusettings/:menuId', function (menuId) {
beermenu.getMenuSettings(menuId, this.res);
});
app.router.get('/beermenu/:companyId/:locationId/:itemType', function (companyId, locationId, itemType) {
beermenu.getBeermenu(companyId, locationId, itemType, this.res);
});
app.start(3000);