minimal go web server
parent
f7cba43f7b
commit
744d7e0860
@ -0,0 +1,3 @@
|
||||
module phc.dm.unipi.it/aziis98/nuovo-sito-poisson
|
||||
|
||||
go 1.13
|
@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func serveHome(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "./views/home.html")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
http.HandleFunc("/", serveHome)
|
||||
|
||||
log.Println("Listening on :8000...")
|
||||
err := http.ListenAndServe(":8000", nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PHC</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHC Poisson</h1>
|
||||
|
||||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Fuga reprehenderit similique pariatur asperiores? Adipisci commodi tempore perspiciatis culpa architecto, accusantium reprehenderit, nisi explicabo minus minima maiores ab consectetur totam quos.
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue