Get Current Weather By City Name, State And Country Code

Get Current Weather By City Name, State And Country Code

get current weather by city name, state and country code use ISO 3166 country codes for city name, state and country code, divided by comma

deno-weather

get current weather by city name, state and country code

use ISO 3166 country codes for city name, state and country code, divided by comma

// pick 1 to import
import { getWeather } from "https://deno.land/x/deno_weather/mod.ts";
import { getWeather } from "https://x.nest.land/deno-weather/mod.ts";
import { getWeather } from "https://denopkg.com/yeukfei02/deno-weather/mod.ts";

json

const weather = await getWeather("london, uk");
console.log("weather = ", weather);

// weather json
{
 coord: { lon: -0.13, lat: 51.51 },
 weather: [ { id: 800, main: "Clear", description: "clear sky", icon: "01d" } ],
 base: "stations",
 main: {
  temp: 289.64,
  feels_like: 288.73,
  temp_min: 287.59,
  temp_max: 290.93,
  pressure: 1021,
  humidity: 67
 },
 visibility: 10000,
 wind: { speed: 1.5 },
 clouds: { all: 9 },
 dt: 1589956771,
 sys: { type: 1, id: 1414, country: "GB", sunrise: 1589947279, sunset: 1590004386 },
 timezone: 3600,
 id: 2643743,
 name: "London",
 cod: 200
}

xml

const weather = await getWeather("london, uk", "xml");
console.log("weather = ", weather);

// weather xml
<?xml version="1.0" encoding="UTF-8"?>
<current>
    <city id="2643743" name="London">
        <coord lon="-0.13" lat="51.51"></coord>
        <country>GB</country>
        <timezone>3600</timezone>
        <sun rise="2020-05-20T04:01:19" set="2020-05-20T19:53:06"></sun>
    </city>
    <temperature value="289.64" min="287.59" max="290.93" unit="kelvin"></temperature>
    <feels_like value="288.73" unit="kelvin"></feels_like>
    <humidity value="67" unit="%"></humidity>
    <pressure value="1021" unit="hPa"></pressure>
    <wind>
        <speed value="1.5" unit="m/s" name="Calm"></speed>
        <gusts></gusts>
        <direction></direction>
    </wind>
    <clouds value="9" name="clear sky"></clouds>
    <visibility value="10000"></visibility>
    <precipitation mode="no"></precipitation>
    <weather number="800" value="clear sky" icon="01d"></weather>
    <lastupdate value="2020-05-20T06:39:31"></lastupdate>
</current>

Download Details:

Author: yeukfei02

Demo: https://deno.land/x/[email protected]

Source Code: https://github.com/yeukfei02/deno-weather

deno nodejs node javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings