daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "io"
  5.     "net/http"
  6. )
  7.  
  8. func main() {
  9.     http.HandleFunc("/", foo)
  10.     http.Handle("/favicon.ico", http.NotFoundHandler())
  11.     http.ListenAndServe(":8080", nil)
  12. }
  13.  
  14. func foo(w http.ResponseWriter, req *http.Request) {
  15.     v := req.FormValue("q")
  16.     w.Header().Set("Content-Type", "text/html; charset=utf-8")
  17.     io.WriteString(w, `
  18.         <form method="post">
  19.             <input type="text" name="q">
  20.             <input type="submit">
  21.         </form>
  22.         <br>`+v)
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top