File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33var express = require ( 'express' ) ,
4+ _ = require ( 'lodash-node' ) ,
45 async = require ( 'async' ) ,
56 db = require ( '../db/stations' ) ,
67 request = require ( 'request' ) ,
@@ -13,6 +14,9 @@ var express = require('express'),
1314/* GET status */
1415router . get ( '/' , function ( req , res , next ) {
1516
17+ if ( _ . isEmpty ( req . query . from ) || _ . isEmpty ( req . query . to ) )
18+ return res . json ( 400 , new ex . BadRequestException ( 'Please provide a valid destination and arrival station' ) ) ;
19+
1620 var searchType = 1 ;
1721 var dateTime = datetime . toCET ( ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ;
1822
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ exports.StationNotFoundException = function(name) {
1212 return new exports . Exception ( 'Could not find station: ' + name , 'StationNotFoundException' , 404 ) ;
1313} ;
1414
15+ exports . BadRequestException = function ( msg ) {
16+ return new exports . Exception ( msg , 'BadRequestException' , 400 ) ;
17+ } ;
18+
1519exports . Exception = function ( msg , type , code ) {
1620 return {
1721 'error' : {
You can’t perform that action at this time.
0 commit comments