Skip to content

Instantly share code, notes, and snippets.

@mattn
Created September 28, 2015 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/41d93589fbdd432c5321 to your computer and use it in GitHub Desktop.
Save mattn/41d93589fbdd432c5321 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/gsp-lang/stdlib/fmt"
"github.com/gsp-lang/gsp/core"
"github.com/gsp-lang/stdlib/prelude"
"github.com/gsp-lang/stdlib/net/http"
)
func hello(w, r core.Any) core.Any {
fmt.Fprintf(w, "hello")
return nil
}
func main() {
http.HandleFunc("/", hello)
http.ListenAndServe(":9090", nil)
}
var _ = prelude.Len
; Copy into example.gsp
(ns main
"/fmt"
"/net/http")
(def hello (fn [w r]
(fmt/fprintf w "hello")
()))
(def main (fn []
(http/handle-func "/" hello)
(http/listen-and-serve ":9090" nil)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment