You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1007 B
43 lines
1007 B
package api
|
|
|
|
import (
|
|
"log"
|
|
"time"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
"github.com/gofiber/fiber/v2/middleware/session"
|
|
|
|
. "MY/webapp/common"
|
|
)
|
|
|
|
var STORE *session.Store
|
|
|
|
func Setup(app *fiber.App) {
|
|
STORE = session.New()
|
|
|
|
app.Static("/", "./public", fiber.Static{
|
|
Compress: false,
|
|
CacheDuration: 1 * time.Nanosecond,
|
|
})
|
|
|
|
app.Get("/api/logout", GetApiLogout)
|
|
app.Post("/api/login", PostApiLogin)
|
|
app.Post("/api/register", PostApiRegister)
|
|
app.Get("/api/feed/:user_id", GetApiFeed)
|
|
app.Get("/api/message/:id", GetApiMessage)
|
|
app.Post("/api/message/new", PostApiMessage)
|
|
app.Get("/api/replies/:message_id", GetApiReplies)
|
|
|
|
app.Get("/feed/", Page("feed"))
|
|
app.Get("/post/view/:id/", Page("post/view"))
|
|
app.Get("/post/new/", Page("post/new"))
|
|
app.Get("/settings/", Page("settings"))
|
|
app.Get("/u/:user_id", Page("profile"))
|
|
|
|
app.Get("/api/restart", GetApiRestart)
|
|
}
|
|
|
|
func Shutdown() {
|
|
log.Println("Shutting down controllers...")
|
|
}
|
|
|