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
getAllGames: (res) => { | |
//For this sprint, all users can see all games | |
return new Promise((resolve, reject) => { | |
dao.getAllGames().then((data) => { | |
for (let i = 0; i < data.length; i++) { | |
data[i].canonical = `/api/game/${data[i].id}`; | |
} | |
res.send(data); | |
resolve(); |
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
dao.getAllGames().then((data) => { | |
for (let i = 0; i < data.length; i++) { | |
data[i].canonical = `/api/game/${data[i].id}`; | |
} | |
res.send(data); | |
}).catch((err) => { | |
//TODO: logging errors | |
res.status(500).send({ error: 'Database error.' }); | |
}); |
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
let data = [{ | |
ID: '1', | |
Name: 'test game', | |
Adult: false, | |
GameMasters: null, | |
Tags: [], | |
IC: null | |
}, | |
{ | |
ID: '2', |
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
//Controller module | |
var express = require('express'); | |
var router = express.Router(); | |
app.route('/book') | |
.get(function(req, res) { | |
res.send('Get a random book'); | |
}) | |
.post(function(req, res) { | |
res.send('Add a book'); |
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
define([ | |
"intern!object", | |
"intern/chai!assert", | |
"intern/dojo/node!../../../src/dao/todoItems", | |
"intern/dojo/node!fs", | |
"intern/dojo/node!is-there", | |
"intern/dojo/node!sinon", | |
"intern/dojo/node!sqlite3", | |
"intern/dojo/node!async" | |
], function (registerSuite, assert, dao, fs, IsThere, sinon, sqlite3, async) { |
NewerOlder