缩短网址,让分享更简单
Shorten Link, Make Sharing Simpler
English | 简体中文
-
⚡️ qwik Accelerate our SSR application from the source
-
📦 iris A High Performance, Easy to Use and Powerful Go Language Web Framework
-
🔎 bolt An efficient, embedded, and persistent key-value storage database, just don't want to use too heavy mysql and redis
-
🎨 TaliWindCss The Patriarch of the Atomic CSS Framework
-
😃 daisyui Use Tailwind CSS but write less class names
-
☁️ Deploy on Netlify, zero-config
-
🦾 Golang, of course
-
🦾 TypeScript, of course
-
Global variable management
-
I18n multi-language switching
{
"timestamp": "2023-01-21 21:15:03",
"latency": 405000,
"code": 200,
"method": "GET",
"path": "/ping",
"ip": "::1",
"bytes_sent": 4
}
app.Post("/login", s.Login)
admin := app.Party("/admin")
{
admin.UseRouter(jwtMiddle.Serve)
admin.Post("/flush", s.Flush)
admin.Get("/all", s.All)
admin.Post("/del", s.DelOne)
}
{
...
app.RegisterDependency(shortService)
...
app.ConfigureContainer(func(api *iris.APIContainer) {
api.Post("/short", s.ShortLink)
api.Get("/u/{key}", s.GetRaw)
})}
...
func (s ShorterCtl) GetRaw(ctx iris.Context, ss *service.ShorterService) {
key := ctx.Params().Get("key")
link, err := ss.GetRaw(key)
if err != nil {
CommonResponse{}.Fail().SetData(err.Error()).Send(ctx)
return
}
ctx.Redirect(link, iris.StatusMovedPermanently)
return
}
### Routing self-test, become a cute backend
```go
var commonSchema = `{
"type": "object",
"properties": {
"code": {"type": "number"},
"msg": {"type": "string"},
"data": {"type": ["object","string"]}},
"required": ["code", "msg", "data"]
}`
func TestAdminApi(t *testing.T) {
app := NewApp()
e := httptest.New(t, app)
e.GET("/admin/all").Expect().Status(httptest.StatusOK).
JSON().Schema(commonSchema)
}