This project implements a basic web server using Go's net/http package. The server serves static files from a designated directory and provides two specific endpoints: /form and /hello.
- Static File Serving: The server serves static files from the
./staticdirectory, allowing for easy access to HTML, CSS, and JavaScript resources. - Form Handling: The
/formendpoint processes POST requests from a form, extractingnameandaddressvalues from the submitted form data.- Returns a confirmation message along with the submitted name and address.
- Hello Endpoint: The
/helloendpoint responds to GET requests with a simple "hello!" message. It also handles incorrect paths and methods by returning appropriate error messages.
- Start the server by running the Go application.
- Access the static files by navigating to
http://localhost:8080/. - To test the form handling, create a simple HTML form that submits data to
http://localhost:8080/form. - Access the hello endpoint by navigating to
http://localhost:8080/hello.
- Go (Golang)
- net/http package
This project serves as a foundational template for understanding HTTP request handling, form processing, and static file serving in Go.