diff --git a/gddController.js b/gddController.js index a80d60d752eeec83a0ab978c5d5ec1946e230543..dc82891bb63d54b31587f1a00dd5327b96977289 100644 --- a/gddController.js +++ b/gddController.js @@ -35,6 +35,7 @@ exports.year_gdd = function (req, res) { var projection = { min_temps: 1, max_temps: 1, + location: 1, } var t_base = 50 @@ -128,7 +129,9 @@ exports.year_gdd = function (req, res) { res.json({ message: "GDDs", date: data["last_date"], - data: gdds + data: gdds, + closest_lon: data["location"]["coordinates"][0], + closest_lat: data["location"]["coordinates"][1] }) }, function(err) { @@ -152,7 +155,9 @@ exports.year_gdd = function (req, res) { res.json({ message: "GDDs", date: data["last_date"], - data: gdds + data: gdds, + closest_lon: data["location"]["coordinates"][0], + closest_lat: data["location"]["coordinates"][1] }) }, function(err) { @@ -187,6 +192,7 @@ exports.normal = function (req, res) { var projection = { min_temps: 1, max_temps: 1, + location: 1, } var t_base = 50 @@ -272,7 +278,9 @@ exports.normal = function (req, res) { res.json({ message: "30-year Normal GDDs", - data: gdds + data: gdds, + closest_lon: data["location"]["coordinates"][0], + closest_lat: data["location"]["coordinates"][1] }) }, function(err) { diff --git a/routes.js b/routes.js index bafc9eed3010a4795d5597f3e2fbeb719db24efa..25f339efd454c5f5db2d3139f7a5a0491cc825cd 100644 --- a/routes.js +++ b/routes.js @@ -41,16 +41,17 @@ var gddController = require('./gddController'); * type: number * minimum: 24.083334 * maximum: 49.916668 - * example: 25.6 + * example: 38.99 * longitude: * description: longitude to calculate gdd on * type: number * minimum: -125.0 * maximum: -66.5 - * example: -78.5 + * example: -76.94 * t_base: - * description: Base temperature to calculate gdd on, in fahrenheit + * description: Base temperature to calculate gdd on, in fahrenheit. NOT REQUIRED * type: number + * example: 50 * * responses: * 200: @@ -72,6 +73,16 @@ var gddController = require('./gddController'); * type: number * minItems: 1 * maxItems: 365 + * closest_lat: + * type: number + * minimum: 24.083334 + * maximum: 49.916668 + * example: 38.99 + * closest_lon: + * type: number + * minimum: -125.0 + * maximum: -66.5 + * example: -76.94 * 400: * description: Bad Request * content: @@ -131,16 +142,17 @@ router.route('/:product/daily/:year') * type: number * minimum: 24.083334 * maximum: 49.916668 - * example: 25.6 + * example: 38.99 * longitude: * description: longitude to calculate gdd on * type: number * minimum: -125.0 * maximum: -66.5 - * example: -78.5 + * example: -76.94 * t_base: - * description: Base temperature to calculate gdd on, in fahrenheit + * description: Base temperature to calculate gdd on, in fahrenheit. NOT REQUIRED * type: number + * example: 50 * * responses: * 200: @@ -157,6 +169,16 @@ router.route('/:product/daily/:year') * type: array * items: * type: number + * closest_lat: + * type: number + * minimum: 24.083334 + * maximum: 49.916668 + * example: 38.99 + * closest_lon: + * type: number + * minimum: -125.0 + * maximum: -66.5 + * example: -78.5 * 400: * description: Bad Request * content: diff --git a/server.js b/server.js index efccad949582d412f54e86b8673f9ba81fdd82fb..642f268eff2352ed89539932f42f337301fe372d 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,7 @@ require('./models/gdd.js'); require('./models/gdd_current.js'); require('./models/normals.js'); -const port = 4000; +const port = 27017; const app = express();