mirror of
https://github.com/jlengrand/pluckr.git
synced 2026-03-10 08:41:17 +00:00
Adds session check route
This commit is contained in:
@@ -21,6 +21,11 @@ fun Application.configureRouting(database: Database) {
|
||||
|
||||
routing {
|
||||
|
||||
get ("/api/session"){
|
||||
val userSession = call.sessions.get<UserSession>()
|
||||
call.respond(userSession?:"{}")
|
||||
}
|
||||
|
||||
authenticate("user_session") {
|
||||
get("/api/authenticated") {
|
||||
call.respondText("Hello, ${call.principal<UserSession>()?.name}!")
|
||||
|
||||
Reference in New Issue
Block a user