GoLang
xxxxxxxxxx
package main
import (
"fmt"
"net/http"
)
func hello(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "hello\n")
}
func headers(w http.ResponseWriter, req *http.Request) {
for name, headers := range req.Header {
for _, h := range headers {
fmt.Fprintf(w, "%v: %v\n", name, h)
}
}
}
func main() {
http.HandleFunc("/hello", hello)
http.HandleFunc("/headers", headers)
http.ListenAndServe(":8090", nil)
}
$ curl localhost:8090/hello hello
Linux - How to Install anc-api-tools
C - Find Largest Number Using Dynamic Memory Allocation
Java - Reverse a Number
Python - How do I sort a dictionary by value?
Linux - How to Install zlib1g-dev
Kotlin - Find Factorial of a Number
C - Count Number of Digits in an Integer
Java - Concatenate Two Arrays
Kotlin - Calculate the Sum of Natural Numbers
Kotlin - Convert Milliseconds to Minutes and Seconds
C++ - Check Whether a Number is Prime or Not
Kotlin - Calculate the Power of a Number
Python - I/O chat very easy chat
Java - Create Pyramid and Pattern
Kotlin - Check Whether a Number is Even or Odd
Kotlin - Get Current Date/TIme
Kotlin - Count Number of Digits in an Integer
Kotlin - Round a Number to n Decimal Places
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month