#include config mach() { return (config) { .resources = {{ {"home", "/", .get = {{ render((r){ "{{< layout}}" "{{$body}}" "
" "

Weather Lookup

" "

Enter a US zip code to get the current forecast

" "
" "
" "" "" "
" "
" "
" "{{/body}}" "{{/layout}}" }) }} }, {"weather", "/weather", .get = {{ validate((v){ .name = "zipcode", .validation = "^[0-9]{5}$", .message = "Zip code must be exactly 5 digits" }), fetch((f){ .set = "weather", .url = "https://wttr.in/{{zipcode}}?format=j1", }), render((r){ "{{< layout}}" "{{$body}}" "
" "

Current Weather

" "{{#nearest_area}}" "

{{areaName}} — {{region}}, {{country}}

" "{{/nearest_area}}" "{{#current_condition}}" "
{{temp_F}}°F
" "
{{weatherDesc}}
" "
" "
" "
Feels Like
" "
{{FeelsLikeF}}°F
" "
" "
" "
Humidity
" "
{{humidity}}%
" "
" "
" "
Wind
" "
{{windspeedMiles}} mph
" "
" "
" "
UV Index
" "
{{uvIndex}}
" "
" "
" "{{/current_condition}}" "← Search another zip code" "
" "{{/body}}" "{{/layout}}" }) }}, .errors = { {http_bad_request, { render((r){ "{{< layout}}" "{{$body}}" "
" "

Oops

" "

Invalid zip code. Please enter exactly 5 digits.

" "← Try again" "
" "{{/body}}" "{{/layout}}" }) }} } } }}, .context = { {"layout", "" "" "Weather App" "" "" "" "{{$body}}{{/body}}" "" "" } } }; }