缩短网址,让分享更简单
Shorten Link, Make Sharing Simpler
简体中文 | English
-
⚡️ qwik 从源头上加速SSR应用
-
📦 iris 一个高性能、易用且功能强大的Go语言Web框架
-
🔎 bolt 一个高效的、嵌入式的、持久化的键值存储数据库, 只是不想用太重的mysql和redis~
-
🎨 TaliWindCss 原子类CSS框架的祖师爷
-
😃 daisyui 使用 Tailwind CSS 但少写类名
-
☁️ Deploy on Netlify, zero-config
-
🦾 Golang, of course
-
🦾 TypeScript, of course
- 全局变量管理
- I18n多语言切换
{
"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
}
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)
}