Skip to content

Commit

Permalink
[UPDATE] better indentment and process.env
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottus committed May 13, 2020
1 parent 9904e47 commit e9b4cc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const cron = require('node-cron');

dotenv.config();
const app = express();
const port = 8080;
const port = process.env.PORT

cron.schedule("40 * * * * *", () => {
console.log("Running Job");
Expand Down
8 changes: 5 additions & 3 deletions src/temperature/temperature.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ temperature = express.Router();

temperature.get('/hour-Avg/:day/:month/:year/:hours', ( req, res ) => {

var query = `SELECT avg(celsius) FROM log where log.day = '${req.params.day}' and log.month = '${req.params.month}'
var query = `SELECT avg(celsius) FROM log where log.day = '${req.params.day}'
and log.month = '${req.params.month}'
and log.year = '${req.params.year}' and log.hours = '${req.params.hours}'; );`

database.get(query, (err,row) =>{
Expand All @@ -20,8 +21,9 @@ temperature.get('/hour-Avg/:day/:month/:year/:hours', ( req, res ) => {
});

temperature.get('/day-Avg/:day/:month/:year', ( req, res ) => {
var query = `SELECT avg(celsius) FROM log where log.day = '${req.params.day}' and log.month = '${req.params.month}'
and log.year = '${req.params.year}'; );`
var query = `SELECT avg(celsius) FROM log where log.day = '${req.params.day}'
and log.month = '${req.params.month}'
and log.year = '${req.params.year}'; );`

database.get(query, (err,row) =>{
if(err) {
Expand Down

0 comments on commit e9b4cc4

Please sign in to comment.