egozen-garage / backpackofwings.earth

This is the official repository for the project "Backpack of Wings" within the exhibition context of Driving the Human
0 stars 0 forks source link

API - include weather data #11

Open valid-void opened 2 years ago

valid-void commented 2 years ago

roadmap

  1. server-side api call

    • setup backend app to implement tasks with Express.js
    • call weather api
    • save weather data
    • frontend api call
  2. call backend through Express api

    • receive data
    • include data in Mapbox
valid-void commented 2 years ago

Step 1 - Setup Backend with Express.js

follow this tutorial for more details: https://www.youtube.com/watch?v=w3vs4a03y3I

Start localhost:5000

  1. change directory to server
  2. open terminal
  3. start server with npm start dev
valid-void commented 2 years ago

Step 2 - Schedule server-side task

follow this tutorila for more details: https://www.youtube.com/watch?v=StkFajPnd7w

test

next: add this number to a database e.g. node-sqlite3 npm install sqlite3 next: call this data array form frontend next: updated frontend if backend data has been updated

valid-void commented 2 years ago

it is not possilbe to schedule server side task on sanity (https://stackoverflow.com/questions/64310565/is-it-possible-with-sanity-scheduled-external-api-calls-to-sanity)

It can be done with Netlify:

set up serverless schedule function on netlify

https://docs.netlify.com/functions/scheduled-functions/

  1. install node moduel in root folder: npm install @netlify/functions