Api / proxy server demo in node.js
- node.js: https://nodejs.org/en/download/
- npm: https://www.npmjs.com/get-npm
npm install
('npm run build' can be used as well)
After running the following command, the application should be available on http://locatlost:8080. (Port number can be changed in config/index.js)
npm run start
Error logging to console is only active in debug mode:
npm run debug
-
Search for 1 day forecast by city name
-
Example:
-
Search for 5 days forecast by city name
-
Example:
{
"forecast": {
"min": {
"text": [ForecastText],
"value": [MinimumValue],
"unit": [Unit]
},
"max": {
"text": [ForecastText],
"value": [MaximumValue],
"unit": [Unit]
},
"rain": {
"text": [RainProbabilityText],
"value": [RainProbabilityValue]
}
}
}
{
"forecast": {
"min": {
"text": [ForecastText],
"value": [MinimumValue],
"unit": [Unit]
},
"max": {
"text": [ForecastText],
"value": [MaximumValue],
"unit": [Unit]
}
}
}
{
error: [ErrorText]
[, searchString: [SearchString]]
}
(The attribute searchString is returned only when no locations have been found, and no other errors occured.)
The following command starts the app in debug mode using nodemon, so the server is restarted on code / config changes:
npm run watch
npm run test