This project is a simple Go-based HTTP server that serves static files and handles form submissions. The server is structured to provide a static website and process user input from a form.
- Static File Serving: The server serves HTML files from the
./static
folder. - Form Submission: The server handles form submissions at the
/form
endpoint. - GET and POST Requests: Handles GET requests for static files and POST requests for form data.
- User Accesses the Website: When a user accesses the website, the
index.html
file is served. - Form Submission: Users can submit a form (name and address) via the
/form
route. The server processes the data and sends a response back with the submitted values.
To run the server:
-
Clone the repository:
git clone https://github.com/piyushdev04/Go-Server cd Go-Server
-
Run the server:
go run main.go
-
Open your browser and navigate to:
http://localhost:8080/
to access the static homepage (index.html
)http://localhost:8080/form
to submit a form with name and address.
Here’s the block diagram showing the interaction between the user, server, and form submission process:
- Go: Backend server handling HTTP requests and serving static files.
- HTML: Frontend for the static pages and form submission.