Skip to content

Repository files navigation

Soon Web Framework

Build StatuscodecovGo Report CardGoDocLicense

Soon is a web framework written in Go (Golang). It features an expressjs-like API.

Installation

To install Soon, you need to install Go and set your Go workspace first.

The first need Go installed (version 1.11+ is required), then you can use the below Go command to install Soon.

$ go get -u github.com/soongo/soon

Quick Start

package main
import (
"github.com/soongo/soon"
)
// an example middlewarefunclogger(c*soon.Context) {
// do something beforec.Next()
// do something after
}
funcmain() {
// soon.SetMode(soon.DebugMode) // enable soon framework debug mode// Create an app with default routerapp:=soon.New()
app.Use(logger) // use middlewareapp.GET("/", func(c*soon.Context) {
c.Send("Hello World")
})
app.GET("/:foo", func(c*soon.Context) {
c.Send(c.Params().Get("foo"))
})
// an example error handlerapp.Use(func(vinterface{}, c*soon.Context) {
msg:="Internal Server Error"switcherr:=v.(type) {
caseerror:
msg=err.Error()
casestring:
msg=err
}
c.Status(500)
c.Send(msg)
})
app.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}

About

Soon is a web framework written in Go (Golang). It features an Express.js-like API.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages