This is a demo of updating a map to show air quality data for the user’s current location using Next.js Advanced Middleware, powered by Netlify Edge Functions.

Overview

Show Local Air Quality Based on the User's Location

Use AQI data to show the air quality near the current user. This is built using Next.js Advanced Middleware and powered by Netlify Edge Functions.

See the demo: https://air-quality-edge-functions.netlify.app

Dev Setup

To run this yourself, you need two sets of credentials:

  1. NEXT_PUBLIC_AQICN_API_KEY — this is free and can be requested from the Air Quality Open Data Platform.

    This is used to create a map overlay showing the air quality on a map. (More info in the AQI docs.)

  2. NEXT_PUBLIC_GOOGLE_API_KEY — this has a free tier and is created on the Google Maps Platform credentials page.

    You need to create a project (the credentials page will guide you through this) and enable both the Maps JavaScript API and the Geocoding API.

    Heads up! Make sure to restrict your API key to just the domain you intend to ship it on and to only have access to the APIs you need. Otherwise your key could be misused and you could end up with an unexpected bill!

Create a Netlify site, then add the above credentials as env vars.

Shortcut: Do it all via CLI!

Note: This assumes you have the GitHub CLI installed, which I highly recommend if you work regularly with GitHub.

# fork this repository
gh repo fork jlengstorf/air-quality-edge-functions

# move into the newly forked and cloned repo
cd air-quality-edge-functions/

# install dependencies
npm i

# install the Netlify CLI if you don't already have it
# details: https://docs.netlify.com/cli/get-started/
npm i -g netlify-cli

# create a new Netlify site
ntl init

# add your env vars
ntl env:set NEXT_PUBLIC_AQICN_API_KEY "<your_key_here>"
ntl env:set NEXT_PUBLIC_GOOGLE_API_KEY "<your_key_here>"

# start the dev server
ntl dev
You might also like...

Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

May 18, 2022

Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

May 3, 2022

Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

Jan 3, 2023

Look up a city and get back weather forecast for searched city and top News headline related to that city and an interactive map which shows the location of that city.

Look up a city and get back weather forecast for searched city and top News headline related to that city and an interactive map which shows the location of that city.

WeatheredVibes Description As a user I want to look up a city to get the current weather and suggested current news articles based on the location sea

Mar 12, 2022

This is the backend of Wherechat, which is a chat application that allows users to find and meet each other through their location on the map.

This is the backend of Wherechat, which is a chat application that allows users to find and meet each other through their location on the map.

wherechat-backend About the project This is the backend of Wherechat, which is a chat application that allows users to find and meet each other throug

Nov 23, 2022

TVMAZE API-based webapp, receives TV show episodes with all data about that TV show.

TVMAZE API-based webapp, receives TV show episodes with all data about that TV show.

TVMAZE API-based webapp, receives TV show episodes with all data about that TV show. The Webapp has two interfaces: A home page, showing a list of Tv show episodes you can like. And a popup window with more data about the TV show that you can comment on.

Aug 9, 2022

aka Scaletor, take screenshots of a piece of a map and scale/compare with other parts of the map

scale-a-tron A quick-and-dirty map that lets you compare one area to another. Draw a shape around a region, zoom in to another place on the map, and c

Nov 7, 2022

An application where a user can search a location by name and specify a genre of music. Based on the parameters entered, a list of radio stations generate based on genre selected in that area.

Signs of the Times Description An application that allows for the user to enter a date and see the horoscope for that day, and famous people born on t

Nov 3, 2022

A minimal e-commerce store using Gatsby, SANITY, Stripe, Use-Shopping-Cart and Netlify

🏪 Gatsby Starter Stripemart Like a supermarket but for Stripe. No ongoing monthly costs. Perfect for artists, creators and independent builders doing

Nov 14, 2022
Owner
Jason Lengstorf
💻 Developer / software architect. 📢 Frequent speaker. 🎨 Occasional designer. 🍸 Mediocre bartender.
Jason Lengstorf
🌬️ Server to collect and send air quality data.

Air Quality Measurement ??️ Server to collect and send air quality data. ?? Table of Contents About How it works Usage Getting Started Built Using Aut

Jean Poffo 5 Oct 12, 2022
A demo to show how to re-use Eleventy Image’s disk cache across Netlify builds.

Re-use Eleventy Image Disk Cache across Netlify Builds Live Demo This repository takes all of the high resolution browser logos and processes them thr

Eleventy 9 Apr 5, 2022
Yassir Assignment AIR Quality (integration external API)

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Imad  Mansour 5 Oct 25, 2022
High performance personalization & a/b testing example using Next.js, Edge Middleware, and Builder.io

Next.js + Builder.io Personalization & A/B Testing with Edge Middleware This is a fork of Next.js Commerce with Builder.io integrated and using Edge M

Builder.io 7 Sep 6, 2022
Hashmat Noorani 4 Mar 21, 2023
Deploy Serverless Functions at the Edge. Current status: Dev

Deploy Serverless Functions at the Edge lagon.app ✉️ Get email updates Open Source • TypeScript • Web APIs Cron triggers • Instant deployments Interac

Lagon 354 Dec 30, 2022
Deploy Serverless Functions at the Edge. Current status: Dev

Deploy Serverless Functions at the Edge ?? Join the Discord ✉️ Get email updates Open Source • TypeScript • Web APIs Cron triggers • Instant deploymen

Lagon 123 Jul 26, 2022
Netlify functions session cookie 🍪

netlify-functions-session-cookie ?? Cryptographically-signed session cookies for Netlify functions. Summary Install Concept and Usage API Environment

Matteo Cargnelutti 7 Jun 8, 2022
This app offers users a quick way to check the current temperature and humidity of any location in the world.

Pretty Weather App This app offers users a quick way to check weather data for any location in the world. The specific data provided by the app includ

Benjamin Semah 3 Jun 7, 2022