This server is a basic web application written in Go, designed to handle form submissions and serve static content.
- Static File Serving (
/): Serves static assets (likeindex.htmlandform.html) from the./staticdirectory. - Form Handling (
/form):- Handles
POSTrequests containing form data (specificallynameandaddress). - Parses the submitted form data and echoes the received "Name" and "Address" back to the client.
- Handles
- Hello Endpoint (
/hello):- Responds to
GETrequests made to/hellowith the text "hello". - Enforces strict routing: it only works for
GETrequests to the exact path/hello.
- Responds to
- Run the application using
go run main.go. - Access the static page at
http://localhost:8080/. - Test the form submission at
http://localhost:8080/form(requires aform.htmlfile with action="/form").