1. Introduction to Serverless
Activity 1: Twitter Bot Backend for Bike Points in London
Solution:
Execute the following steps to complete this activity:
- Create a
main.gofile for registering function handlers, as in Exercise 1.This code is the entry point of the application where functions are registered, and the main application is started:
package main import ( "fmt" "net/http" ) func main() { fmt.Println("Starting the 🚲 finder..") http.HandleFunc("/", FindBikes) fmt.Println("Function handlers are registered.") http.ListenAndServe(":8080", nil) } - Create a
function.gofile for theFindBikesfunction:... func FindBikes(w http.ResponseWriter, r *http.Request) { ... // Get bike points for the query bikePoints, err := httpClient.Get(fmt.Sprintf...