├── .gitignore ├── LICENSE ├── README.md ├── app.js ├── images └── hero__disaster-flood.jpg ├── lib ├── api-util.js ├── daily-forecast.js ├── severe-weather-power-disruption-index.js ├── tropical-forecast-projected-path.js ├── weather-alert-details.js └── weather-alert-headlines.js ├── manifest.yml ├── package-lock.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # vscode 64 | .vscode/ 65 | 66 | # hidden mac file 67 | .DS_Store 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/badge/License-Apache2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![Community](https://img.shields.io/badge/Join-Community-blue.svg)](https://developer.ibm.com/callforcode/solutions/projects/get-started/) 2 | 3 | # Weather Company Data API access for IBM Cloud 4 | 5 | This project shows how to build a basic data access application that continuously runs in the background, processing a variety of weather data from the Weather Company Data for IBM REST API endpoints, including severe weather alerts, tropical storm forecasts, and the daily weather almanac to find conditions over time. 6 | 7 | ## Obtain a Weather Company API Key 8 | 9 | If you are participating in the [Call for Code](https://developer.ibm.com/callforcode/solutions/projects/get-started/) Global Challenge, request access to [The Weather Company APIs](https://developer.ibm.com/callforcode/tools/weather/). Registration is free and will be available while the Call for Code Global Challenge is taking place. After you agree to the terms, you will receive your API key. Additional documentation about The Weather Company APIs for Call for Code is available [here](https://developer.ibm.com/blogs/call-for-code-the-weather-company-and-you/). 10 | 11 | ## Getting Started in IBM Cloud 12 | 13 | Deploy this application to IBM Cloud. 14 | 15 | 1. Install and configure the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli) 16 | 2. Clone this repository 17 | ``` 18 | $ git clone https://github.com/Call-for-Code/weather-api-nodejs.git 19 | $ cd weather-api-nodejs 20 | ``` 21 | 3. Deploy the application without starting it 22 | ``` 23 | $ ibmcloud cf push --no-start 24 | ``` 25 | 4. Configure your Weather API key `` and start the application 26 | ``` 27 | $ ibmcloud cf set-env weather-api-nodejs WEATHER_API_KEY 28 | $ ibmcloud cf start weather-api-nodejs 29 | ``` 30 | 31 | ## Getting Started on your local machine 32 | 33 | To run this application on your local machine, first install Node.js. 34 | 35 | 1. Clone this repository 36 | ``` 37 | $ git clone https://github.com/Call-for-Code/weather-api-nodejs.git 38 | $ cd weather-api-nodejs 39 | ``` 40 | 2. Install the dependencies 41 | ``` 42 | $ npm install 43 | ``` 44 | 3. Set your Weather API key `` when running the application 45 | ``` 46 | $ WEATHER_API_KEY= node app.js 47 | ``` 48 | 49 | ## Links 50 | 51 | - [Call for Code](https://callforcode.org/) 52 | - [Call for Code - IBM Developer](https://developer.ibm.com/callforcode/) 53 | - [Call for Code: The Weather Company and you](https://developer.ibm.com/callforcode/blogs/call-for-code-the-weather-company-and-you/) 54 | 55 | ## License 56 | 57 | This code is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/Call-for-Code/weather-api-nodejs/tree/master/LICENSE). 58 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const request = require('request-promise-native') 2 | 3 | const weatherAlertHeadlines = require('./lib/weather-alert-headlines') 4 | const weatherAlertDetails = require('./lib/weather-alert-details') 5 | const tropicalForecastProjectedPath = require('./lib/tropical-forecast-projected-path') 6 | const dailyForecast = require('./lib/daily-forecast') 7 | const severeWeatherPower = require('./lib/severe-weather-power-disruption-index') 8 | 9 | const handleFail = function (err) { 10 | // API call failed... 11 | console.error(err.hasOwnProperty('message') ? err.message : err) 12 | } 13 | 14 | const callWeatherAlertHeadlines = function (lat, lon) { 15 | let options = weatherAlertHeadlines.requestOptions(lat, lon) 16 | 17 | request(options) 18 | .then(parsedBody => { 19 | let detailKeys = weatherAlertHeadlines.handleResponse(parsedBody) 20 | if (detailKeys && detailKeys.length > 0) { 21 | detailKeys.forEach(detailKey => { 22 | callWeatherAlertDetails(detailKey) 23 | }) 24 | } 25 | }) 26 | .catch(handleFail) 27 | } 28 | 29 | const callWeatherAlertDetails = function (detailKey) { 30 | let options = weatherAlertDetails.requestOptions(detailKey) 31 | 32 | request(options) 33 | .then(weatherAlertDetails.handleResponse) 34 | .catch(handleFail) 35 | } 36 | 37 | const callTropicalForecastProjectedPath = function () { 38 | let options = tropicalForecastProjectedPath.requestOptions() 39 | 40 | request(options) 41 | .then(tropicalForecastProjectedPath.handleResponse) 42 | .catch(handleFail) 43 | } 44 | 45 | const callDailyForecast = function (lat, lon) { 46 | let options = dailyForecast.requestOptions(lat, lon) 47 | 48 | request(options) 49 | .then(dailyForecast.handleResponse) 50 | .catch(handleFail) 51 | } 52 | 53 | const callSevereWeatherPowerDisruption = function (lat, lon) { 54 | let options = severeWeatherPower.requestOptions(lat, lon) 55 | 56 | request(options) 57 | .then(severeWeatherPower.handleResponse) 58 | .catch(handleFail) 59 | } 60 | 61 | // Configure the locations (lat/lon) you want to use 62 | const loc = { 63 | boston: { lat: '42.3600', lon: '-71.06536' }, // Boston, MA, United States 64 | raleigh: { lat: '35.843686', lon: '-78.78548' }, // Raleigh, NC, United States 65 | losangeles: { lat: '34.040873', lon: '-118.482745' }, // Los Angeles, CA, United States 66 | lakecity: { lat: '44.4494119', lon: '-92.2668435' }, // Lake CIty, MN, United States 67 | newyork: { lat: '40.742089', lon: '-73.987908' }, // New York, NY, United States 68 | hawaii: { lat: '33.40', lon: '-83.42' }, // Hawaii, United States 69 | puntacana: { lat: '18.57001', lon: '-68.36907' }, // Punta Cana, Dominican Republic 70 | jakarta: { lat: '-5.7759349', lon: '106.1161341' } // Jakarta, Indonesia 71 | } 72 | 73 | /** 74 | * Make a single API call 75 | */ 76 | callDailyForecast(loc.raleigh.lat, loc.raleigh.lon) 77 | // callWeatherAlertHeadlines(loc.lakecity.lat, loc.lakecity.lon) 78 | // callSevereWeatherPowerDisruption(loc.jakarta.lat, loc.jakarta.lon) 79 | // callTropicalForecastProjectedPath() 80 | // callWeatherAlertDetails('06439e88-320a-3722-ae90-097484ff2277') 81 | 82 | /** 83 | * Setting up a job to look for weather alert headlines every 10 minutes 84 | */ 85 | const interval = 1000 * 60 * 10 // 10 minutes 86 | 87 | setInterval(() => { 88 | callWeatherAlertHeadlines(loc.lakecity.lat, loc.lakecity.lon) 89 | }, interval) 90 | -------------------------------------------------------------------------------- /images/hero__disaster-flood.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Call-for-Code/weather-api-nodejs/a5a2f543560fe1748ae522d1195bd14a8c276714/images/hero__disaster-flood.jpg -------------------------------------------------------------------------------- /lib/api-util.js: -------------------------------------------------------------------------------- 1 | exports.HOST = 'https://api.weather.com' 2 | 3 | exports.defaultParams = function () { 4 | return { 5 | qs: { 6 | apiKey: process.env.WEATHER_API_KEY, 7 | language: 'en-US' 8 | }, 9 | headers: { 10 | 'User-Agent': 'Request-Promise', 11 | 'Accept': 'application/json', 12 | 'gzip': true 13 | }, 14 | json: true // parse the response as JSON 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/daily-forecast.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Daily Forecast 3 | * 4 | * - https://ibm.co/V3DFap 5 | * 6 | * The daily forecast API returns the geocode weather forecasts for the current day 7 | * up to the days duration in the API endpoint. The daily forecast product can contain 8 | * multiple days of daily forecasts for each location. Each day of a forecast can 9 | * contain up to (3) “temporal segments” meaning three separate forecasts. For any 10 | * given forecast day we offer day, night, and a 24-hour forecast (daily summary). 11 | * 12 | * Base URL: api.weather.com/v3 13 | * Endpoint: /wx/forecast/daily/15day 14 | */ 15 | 16 | const apiUtil = require('./api-util') 17 | 18 | exports.requestOptions = function (lat, lon, days = 15, units = 'm') { 19 | const d = [3, 5, 7, 10, 15].indexOf(days) === -1 ? 15 : days 20 | const u = ['e', 'm', 'h', 's'].indexOf(units) === -1 ? 'm' : units 21 | 22 | let options = apiUtil.defaultParams() 23 | 24 | options.qs['units'] = u 25 | let urlparams="&format=json&units="+options.qs['units']+"&language="+options.qs['language']+"&apiKey="+options.qs['apiKey'] 26 | options['url'] = `${apiUtil.HOST}/v3/wx/forecast/daily/${d}day?geocode=${lat},${lon}`+urlparams 27 | //console.log( options ); 28 | 29 | return options 30 | } 31 | 32 | exports.handleResponse = function (res) { 33 | if (res && res.hasOwnProperty('narrative')) { 34 | const forecasts = res 35 | console.log(`daily-forecast: returned ${forecasts.dayOfWeek.length}-day forecast`) 36 | 37 | // Parse responses 38 | for( num=0; num { 29 | console.log(`severe-weather-power-disruption-index: ${disruptIndex}: ${p['powerDisruptionCategory'][i]}`) 30 | }) 31 | } else { 32 | console.log('severe-weather-power-disruption-index: no power distruption info returned') 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/tropical-forecast-projected-path.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tropical -Forecast - Projected Path 3 | * 4 | * - https://weather.com/swagger-docs/ui/sun/v2/SUNv2TropicalForecastProjectedPathSourceAndBasinOnly.json 5 | * 6 | * The Tropical Forecast - Projected Path API provides the ability query the single 7 | * projected path per active storm. Active storm - any storm that has reported in the 8 | * last 168 hours. One can query by basin or selected source. 9 | * 10 | * Base URL: api.weather.com/v2 11 | * Endpoint: /tropical/projectedpath 12 | */ 13 | 14 | const apiUtil = require('./api-util') 15 | 16 | exports.requestOptions = function (basin = 'AL', units = 'm', nautical = true, source = 'all') { 17 | const u = ['e', 'm', 'h', 's'].indexOf(units) === -1 ? 'm' : units 18 | 19 | let options = apiUtil.defaultParams() 20 | 21 | options['uri'] = `${apiUtil.HOST}/v2/tropical/projectedpath` 22 | options.qs['units'] = u 23 | options.qs['basin'] = basin 24 | options.qs['nautical'] = !!nautical 25 | options.qs['source'] = source 26 | options.qs['format'] = 'json' 27 | 28 | return options 29 | } 30 | 31 | exports.handleResponse = function (res) { 32 | if (res && res.hasOwnProperty('advisoryinfo')) { 33 | console.log(`tropical-forecast-projected-path: returned ${res.advisoryinfo.length} advisory info`) 34 | 35 | res.advisoryinfo.forEach(storm => { 36 | // the storm's storm_name, projectedpath, and projectedpath.heading objects are probably of interest 37 | console.log(`tropical-forecast-projected-path: Advisoory for storm '${storm.storm_name}' by '${storm.source}'`) 38 | console.log(`tropical-forecast-projected-path: ${storm.storm_name} - ${JSON.stringify(storm.projectedpath)}`) 39 | }) 40 | } else { 41 | console.log('tropical-forecast-projected-path: No advisory info available') 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/weather-alert-details.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Weather Alerts Detail 3 | * 4 | * - https://weather.com/swagger-docs/ui/sun/v3/sunV3AlertsWeatherAlertDetail.json 5 | * 6 | * The Weather Alert Details API provides weather watches, warnings, statements and 7 | * advisories issued by the NWS (National Weather Service), Environment Canada and 8 | * MeteoAlarm. These weather alerts can provide crucial life-saving information. 9 | * Weather alerts can be complicated and do not always follow consistent standards, 10 | * format and rules. The Weather Channel (TWC) strives to ensure that the information 11 | * is consistent from all of the different sources but the content is subject to 12 | * change whenever there is an update from the authoritative source. The Weather Alert 13 | * Headlines API returns active weather alert headlines related to Severe 14 | * Thunderstorms, Tornadoes, Earthquakes, Floods, etc . This API also returns 15 | * non-weather alerts such as Child Abduction Emergency and Law Enforcement Warnings. 16 | * The Alert Headlines API also provides a key value found in the attribute to access 17 | * the alert details in the Alert Details API. Your application should first call the 18 | * Weather Alert Headlines API and use the value found in the attribute to request the 19 | * detailed information found in the Weather Alert Details API. 20 | * 21 | * Base URL: api.weather.com/v3 22 | * Endpoint: /alerts/detail 23 | */ 24 | 25 | const apiUtil = require('./api-util') 26 | 27 | exports.requestOptions = function (key) { 28 | let options = apiUtil.defaultParams() 29 | 30 | options['uri'] = `${apiUtil.HOST}/v3/alerts/detail` 31 | options.qs['alertId'] = key 32 | options.qs['format'] = 'json' 33 | 34 | return options 35 | } 36 | 37 | exports.handleResponse = function (res) { 38 | if (res && res.hasOwnProperty('alertDetail')) { 39 | const alert = res['alertDetail'] 40 | // Main thing here that is not in the alert headline is the alert.texts array 41 | console.log(`weather-alerts-detail: ${alert.headlineText}`) 42 | 43 | if (alert.hasOwnProperty('texts')) { 44 | alert.texts.forEach(text => { 45 | console.log(text.languageCode) 46 | console.log(text.instruction) 47 | console.log(text.overview) 48 | console.log(text.description) 49 | }) 50 | } else { 51 | console.log('weather-alerts-detail: No alert text available') 52 | } 53 | } else { 54 | console.log('weather-alerts-detail: No alert detail available') 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/weather-alert-headlines.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Weather Alerts Headlines 3 | * 4 | * - https://weather.com/swagger-docs/ui/sun/v3/sunV3AlertsWeatherAlertsHeadlines.json 5 | * 6 | * The Weather Alert Headlines API provides weather watches, warnings, statements and 7 | * advisories issued by the NWS (National Weather Service), Environment Canada and 8 | * MeteoAlarm. These weather alerts can provide crucial life-saving information. 9 | * Weather alerts can be complicated and do not always follow consistent standards, 10 | * format and rules. The Weather Channel (TWC) strives to ensure that the information 11 | * is consistent from all of the different sources but the content is subject to 12 | * change whenever there is an update from the authoritative source. 13 | * 14 | * The Weather Alert Headline API returns active weather alert headlines related to 15 | * Severe Thunderstorms, Tornadoes, Earthquakes, Floods, etc . This API also returns 16 | * non-weather alerts such as Child Abduction Emergency and Law Enforcement Warnings. 17 | * The Alert Headlines API also provides a key value found in the attribute to access 18 | * the alert details in the Alert Details API. 19 | * 20 | * Base URL: api.weather.com/v3 21 | * Endpoint: /alerts/headlines 22 | */ 23 | 24 | const apiUtil = require('./api-util') 25 | 26 | exports.requestOptions = function (lat, lon) { 27 | let options = apiUtil.defaultParams() 28 | 29 | options['uri'] = `${apiUtil.HOST}/v3/alerts/headlines` 30 | options.qs['geocode'] = `${lat},${lon}` 31 | options.qs['format'] = 'json' 32 | 33 | return options 34 | } 35 | 36 | exports.handleResponse = function (res) { 37 | let details = [] 38 | 39 | if (res && res.hasOwnProperty('alerts')) { 40 | // loop through alerts 41 | res.alerts.forEach(alert => { 42 | // check some fields to decide if this alert is important to you. 43 | console.log(JSON.stringify(alert)) 44 | 45 | if (alert.certaintyCode <= 3 && alert.urgencyCode <= 3 && alert.severityCode <= 3) { 46 | details.push(alert.detailKey) 47 | } 48 | }) 49 | 50 | console.log(`weather-alert-headlines: returning ${details.length} alert(s) meeting threshold out of ${res.alerts.length} total`) 51 | } else { 52 | console.log('weather-alert-headlines: No alerts in area') 53 | } 54 | 55 | return details 56 | } 57 | -------------------------------------------------------------------------------- /manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: weather-api-nodejs 4 | command: npm start 5 | path: . 6 | memory: 256M 7 | instances: 1 8 | no-route: true 9 | health-check-type: process 10 | env: 11 | WEATHER_API_KEY: 12 | NPM_CONFIG_PRODUCTION: false 13 | buildpack: https://github.com/cloudfoundry/nodejs-buildpack 14 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weather-api-nodejs", 3 | "version": "0.2.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "ajv": { 8 | "version": "6.12.3", 9 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", 10 | "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", 11 | "requires": { 12 | "fast-deep-equal": "^3.1.1", 13 | "fast-json-stable-stringify": "^2.0.0", 14 | "json-schema-traverse": "^0.4.1", 15 | "uri-js": "^4.2.2" 16 | } 17 | }, 18 | "asn1": { 19 | "version": "0.2.4", 20 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 21 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 22 | "requires": { 23 | "safer-buffer": "~2.1.0" 24 | } 25 | }, 26 | "assert-plus": { 27 | "version": "1.0.0", 28 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 29 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 30 | }, 31 | "asynckit": { 32 | "version": "0.4.0", 33 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 34 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 35 | }, 36 | "aws-sign2": { 37 | "version": "0.7.0", 38 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 39 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 40 | }, 41 | "aws4": { 42 | "version": "1.10.0", 43 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", 44 | "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" 45 | }, 46 | "bcrypt-pbkdf": { 47 | "version": "1.0.2", 48 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 49 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 50 | "requires": { 51 | "tweetnacl": "^0.14.3" 52 | } 53 | }, 54 | "caseless": { 55 | "version": "0.12.0", 56 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 57 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 58 | }, 59 | "combined-stream": { 60 | "version": "1.0.8", 61 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 62 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 63 | "requires": { 64 | "delayed-stream": "~1.0.0" 65 | } 66 | }, 67 | "core-util-is": { 68 | "version": "1.0.2", 69 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 70 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 71 | }, 72 | "dashdash": { 73 | "version": "1.14.1", 74 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 75 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 76 | "requires": { 77 | "assert-plus": "^1.0.0" 78 | } 79 | }, 80 | "delayed-stream": { 81 | "version": "1.0.0", 82 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 83 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 84 | }, 85 | "ecc-jsbn": { 86 | "version": "0.1.2", 87 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 88 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 89 | "requires": { 90 | "jsbn": "~0.1.0", 91 | "safer-buffer": "^2.1.0" 92 | } 93 | }, 94 | "extend": { 95 | "version": "3.0.2", 96 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 97 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 98 | }, 99 | "extsprintf": { 100 | "version": "1.3.0", 101 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 102 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 103 | }, 104 | "fast-deep-equal": { 105 | "version": "3.1.3", 106 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 107 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" 108 | }, 109 | "fast-json-stable-stringify": { 110 | "version": "2.1.0", 111 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 112 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" 113 | }, 114 | "forever-agent": { 115 | "version": "0.6.1", 116 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 117 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 118 | }, 119 | "form-data": { 120 | "version": "2.3.3", 121 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 122 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 123 | "requires": { 124 | "asynckit": "^0.4.0", 125 | "combined-stream": "^1.0.6", 126 | "mime-types": "^2.1.12" 127 | } 128 | }, 129 | "getpass": { 130 | "version": "0.1.7", 131 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 132 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 133 | "requires": { 134 | "assert-plus": "^1.0.0" 135 | } 136 | }, 137 | "har-schema": { 138 | "version": "2.0.0", 139 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 140 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 141 | }, 142 | "har-validator": { 143 | "version": "5.1.3", 144 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", 145 | "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", 146 | "requires": { 147 | "ajv": "^6.5.5", 148 | "har-schema": "^2.0.0" 149 | } 150 | }, 151 | "http-signature": { 152 | "version": "1.2.0", 153 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 154 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 155 | "requires": { 156 | "assert-plus": "^1.0.0", 157 | "jsprim": "^1.2.2", 158 | "sshpk": "^1.7.0" 159 | } 160 | }, 161 | "is-typedarray": { 162 | "version": "1.0.0", 163 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 164 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 165 | }, 166 | "isstream": { 167 | "version": "0.1.2", 168 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 169 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 170 | }, 171 | "jsbn": { 172 | "version": "0.1.1", 173 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 174 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 175 | }, 176 | "json-schema-traverse": { 177 | "version": "0.4.1", 178 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 179 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" 180 | }, 181 | "json-stringify-safe": { 182 | "version": "5.0.1", 183 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 184 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 185 | }, 186 | "jsprim": { 187 | "version": "1.4.2", 188 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", 189 | "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", 190 | "requires": { 191 | "assert-plus": "1.0.0", 192 | "extsprintf": "1.3.0", 193 | "json-schema": "0.4.0", 194 | "verror": "1.10.0" 195 | }, 196 | "dependencies": { 197 | "json-schema": { 198 | "version": "0.4.0", 199 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", 200 | "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" 201 | } 202 | } 203 | }, 204 | "lodash": { 205 | "version": "4.17.21", 206 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 207 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" 208 | }, 209 | "mime-db": { 210 | "version": "1.44.0", 211 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", 212 | "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" 213 | }, 214 | "mime-types": { 215 | "version": "2.1.27", 216 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", 217 | "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", 218 | "requires": { 219 | "mime-db": "1.44.0" 220 | } 221 | }, 222 | "oauth-sign": { 223 | "version": "0.9.0", 224 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 225 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 226 | }, 227 | "performance-now": { 228 | "version": "2.1.0", 229 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 230 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 231 | }, 232 | "psl": { 233 | "version": "1.8.0", 234 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", 235 | "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" 236 | }, 237 | "punycode": { 238 | "version": "2.1.1", 239 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 240 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 241 | }, 242 | "qs": { 243 | "version": "6.5.3", 244 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", 245 | "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" 246 | }, 247 | "request": { 248 | "version": "2.88.2", 249 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", 250 | "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", 251 | "requires": { 252 | "aws-sign2": "~0.7.0", 253 | "aws4": "^1.8.0", 254 | "caseless": "~0.12.0", 255 | "combined-stream": "~1.0.6", 256 | "extend": "~3.0.2", 257 | "forever-agent": "~0.6.1", 258 | "form-data": "~2.3.2", 259 | "har-validator": "~5.1.3", 260 | "http-signature": "~1.2.0", 261 | "is-typedarray": "~1.0.0", 262 | "isstream": "~0.1.2", 263 | "json-stringify-safe": "~5.0.1", 264 | "mime-types": "~2.1.19", 265 | "oauth-sign": "~0.9.0", 266 | "performance-now": "^2.1.0", 267 | "qs": "~6.5.2", 268 | "safe-buffer": "^5.1.2", 269 | "tough-cookie": "~2.5.0", 270 | "tunnel-agent": "^0.6.0", 271 | "uuid": "^3.3.2" 272 | } 273 | }, 274 | "request-promise-core": { 275 | "version": "1.1.4", 276 | "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", 277 | "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", 278 | "requires": { 279 | "lodash": "^4.17.19" 280 | } 281 | }, 282 | "request-promise-native": { 283 | "version": "1.0.9", 284 | "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", 285 | "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", 286 | "requires": { 287 | "request-promise-core": "1.1.4", 288 | "stealthy-require": "^1.1.1", 289 | "tough-cookie": "^2.3.3" 290 | } 291 | }, 292 | "safe-buffer": { 293 | "version": "5.2.1", 294 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 295 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 296 | }, 297 | "safer-buffer": { 298 | "version": "2.1.2", 299 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 300 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 301 | }, 302 | "sshpk": { 303 | "version": "1.16.1", 304 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 305 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", 306 | "requires": { 307 | "asn1": "~0.2.3", 308 | "assert-plus": "^1.0.0", 309 | "bcrypt-pbkdf": "^1.0.0", 310 | "dashdash": "^1.12.0", 311 | "ecc-jsbn": "~0.1.1", 312 | "getpass": "^0.1.1", 313 | "jsbn": "~0.1.0", 314 | "safer-buffer": "^2.0.2", 315 | "tweetnacl": "~0.14.0" 316 | } 317 | }, 318 | "stealthy-require": { 319 | "version": "1.1.1", 320 | "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", 321 | "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" 322 | }, 323 | "tough-cookie": { 324 | "version": "2.5.0", 325 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", 326 | "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", 327 | "requires": { 328 | "psl": "^1.1.28", 329 | "punycode": "^2.1.1" 330 | } 331 | }, 332 | "tunnel-agent": { 333 | "version": "0.6.0", 334 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 335 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 336 | "requires": { 337 | "safe-buffer": "^5.0.1" 338 | } 339 | }, 340 | "tweetnacl": { 341 | "version": "0.14.5", 342 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 343 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" 344 | }, 345 | "uri-js": { 346 | "version": "4.2.2", 347 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", 348 | "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 349 | "requires": { 350 | "punycode": "^2.1.0" 351 | } 352 | }, 353 | "uuid": { 354 | "version": "3.4.0", 355 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 356 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" 357 | }, 358 | "verror": { 359 | "version": "1.10.0", 360 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 361 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 362 | "requires": { 363 | "assert-plus": "^1.0.0", 364 | "core-util-is": "1.0.2", 365 | "extsprintf": "^1.2.0" 366 | } 367 | } 368 | } 369 | } 370 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weather-api-nodejs", 3 | "version": "0.2.1", 4 | "description": "Demonstrates using the Weather Company Data for IBM Cloud", 5 | "main": "app.js", 6 | "scripts": { 7 | "start": "node app.js" 8 | }, 9 | "dependencies": { 10 | "request": "^2.88.2", 11 | "request-promise-native": "^1.0.9" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/Call-for-Code/weather-api-nodejs.git" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/Call-for-Code/weather-api-nodejs/issues" 19 | }, 20 | "homepage": "https://github.com/Call-for-Code/weather-api-nodejs#readme", 21 | "author": "Raj Singh (http://rajsingh.org)", 22 | "contributors": [ 23 | "va barbosa (https://github.com/vabarbosa/)" 24 | ], 25 | "license": "Apache-2.0" 26 | } 27 | --------------------------------------------------------------------------------