Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

soongo/soon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

48 Commits

Repository files navigation

Soon Web Framework

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 middleware
func logger(c *soon.Context) {
// do something before
c.Next()
// do something after
}

func main() {
// soon.SetMode(soon.DebugMode) // enable soon framework debug mode

// Create an app with default router
app := soon.New()

app.Use(logger) // use middleware

app.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 handler
app.Use(func(v interface{}, c *soon.Context) {
msg := "Internal Server Error"
switch err := v.(type) {
case error:
msg = err.Error()
case string:
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

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors