Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple Weather API (sample)
const http = require('http');
const url = require('url');
// assumes a sibling .env file with
const dotenv = require('dotenv').config();
const appid = process.env.OPENWEATHER_APIKEY;
function httpHandler (request, response) {
let parsed_url = url.parse(request.url, true);
let zip =;
let country = || 'us';
let query_string = `zip=${zip},${country}&APPID=${appid}`
weather_response => { weather_response.pipe(response, {end: true}) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.