Skip to content

Commit

Permalink
remove translate - add start.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
Upperstage committed Jun 16, 2017
1 parent ee0d10d commit cad5a26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const app = require('express')(),
translations = config.translations,
configurations = new ( require('./database/repositories/CustomerConfigurationsRepository') )(databaseClientProvider(config.database));


/**
* Handles logging errors and responding to the client with error messages
* @param error
Expand Down Expand Up @@ -52,7 +53,7 @@ app.get('/configuration', Promise.coroutine(function*(request, response) {
// @TODO - this is a problem!
// if ( !result || !result.length ) return errorHandler( `There was an issue retrieving results.`, response );

response.json(translate(translations.serverToClient, result));
response.json(result);
} catch (error) {
errorHandler(error, response);
}
Expand All @@ -69,7 +70,7 @@ app.get('/configuration/:serialNumber', Promise.coroutine(function*(request, res
const result = yield configurations.get({ serialNumber: request.params.serialNumber });
if (!result) return errorHandler('Configuration object not found.', response, 404);

response.json(translate(translations.serverToClient, result));
response.json(result);
} catch (error) {
errorHandler(error, response);
}
Expand All @@ -81,6 +82,7 @@ app.get('/configuration/:serialNumber', Promise.coroutine(function*(request, res
* @param serialNumber
*/
app.put('/configuration/:serialNumber', Promise.coroutine(function*(request, response) {

console.log(`PUT /configuration/${request.params.serialNumber}`);
// @todo: This has not been implemented in the AqlClient
try {
Expand All @@ -98,6 +100,7 @@ app.put('/configuration/:serialNumber', Promise.coroutine(function*(request, res
* Create a new configuration object
*/
app.post('/configuration', Promise.coroutine(function*(request, response) {

try {
const result = yield configurations.insert(translate(translations.clientToServer, request.body));
if (!result) return errorHandler(`There was an issue creating the configuration object.`, response);
Expand Down
3 changes: 3 additions & 0 deletions start.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set DATABASE_HOST=207.201.192.227
set DATABASE_PORT=11432
node index.js

0 comments on commit cad5a26

Please sign in to comment.