1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-05-31 21:59:42 +02:00

36 lines
713 B
Go
Raw Normal View History

2020-12-26 15:17:20 +00:00
package main
import (
"fmt"
"net/http"
"github.com/micro/go-micro/v2/web"
)
func index(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `<html>
<body>
<h1>This is a regular form</h1>
<form action="http://localhost:8080/form/submit" method="POST">
<input type="text" id="thing" name="thing" />
<button>submit</button>
</form>
<h1>This is a multipart form</h1>
<form action="http://localhost:8080/form/multipart" method="POST" enctype="multipart/form-data">
<input type="text" id="thing" name="thing" />
<button>submit</button>
</form>
</body>
</html>
`)
}
func main() {
service := web.NewService(
web.Name("go.micro.web.form"),
)
service.Init()
service.HandleFunc("/", index)
service.Run()
}