From c724e46341438a2f27897fe73d789d7cbcd6bafc Mon Sep 17 00:00:00 2001 From: tuckersiegel <siegel.tucker@gmail.com> Date: Mon, 22 Feb 2021 16:38:45 -0500 Subject: [PATCH] swagger documentation update --- gddController.js | 14 +++++++++++--- routes.js | 34 ++++++++++++++++++++++++++++------ server.js | 2 +- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/gddController.js b/gddController.js index a80d60d..dc82891 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 bafc9ee..25f339e 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 efccad9..642f268 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(); -- GitLab