This example implements web form submission Go. This is a login application where the user signs in with his/her username and password. Once a user is authenticated, the application will persist the session using JWT.
This application has the following functions:
- Reads a file from the filesystem and streams the static file content to the web as a web form for the user to log in.
- Handles the submitted form.
- Persists a JWT in a cookie when the user is authenticated successfully.
- Redirects the user to another static web page called welcome page, which is only accessible to authorized users. The application examines if a valid JWT is in the request.
- Disables browser caching on the welcome page.
-
Run the server
$ make run
-
Launch a web browser and navigate to http://localhost:8000.