Writing a Simple Web Application
This lesson provides a program, and detailed description to design a web application, printing response in the form of HTML.
We'll cover the following...
We'll cover the following...
A web application
In the following program from line 7 to line 10, we see how the HTML, needed for our web form (which is a simple input form with text box and submit button) is stored in a multi-line string constant form.
The program starts a webserver on port 3000 at line 39. It uses a combined if statement so that, whenever an error occurs, the web server stops with a panic statement (see line 40). Before starting a webserver, we see two so-called routing statements:
- http.HandleFunc("/test1", SimpleServer)at line 37