Discover Packages
github.com/spkane/gotraining
topics
web
posts
directory
Version:
v0.0.0-...-b3bf091
Opens a new window with list of versions in this module.
Published: Nov 29, 2017
License: Apache-2.0
Opens a new window with license information.
README
README
¶
Web - Posts and Forms
Learn the basics of making POST calls and working with multipart form data.
Notes
The standard library has much of what you need to build services and apps.
The net/http
package provides the building blocks.
There are other great packages in the Go ecosystem to help.
Links
https://golang.org/pkg/net/http/
https://golang.org/doc/articles/wiki/
Code Review
Basic POST: Code | Test
Simple Form: Code | Test
Structured Form Parsing: Code | Test
Multipart Forms: Code | Test
Exercises
Exercise 1
Take the multipart writer example and add support for a new form field that would specify the name of the folder to use for the uploaded image. If it does not exist use the current directory as the default. Then update the test to validate the code change.
All material is licensed under the Apache License Version 2.0, January 2004 .
Expand ▾
Collapse ▴
Directories
¶
Sample program to show how to handle different HTTP verbs.
Sample program to show how to handle different HTTP verbs.
Sample program to show how to handle forms using a single handler for the GET and POST calls.
Sample program to show how to handle forms using a single handler for the GET and POST calls.
Sample program to show how to decode forms into structs.
Sample program to show how to decode forms into structs.
Sample program to show how to handle the uploading of file content in a request.
Sample program to show how to handle the uploading of file content in a request.
Click to show internal directories.
Click to hide internal directories.