hi019 / session-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

session-example

This is a minimal example of an authentication system using Fiber, Prisma's Go Client and Fiber's Session middleware.

Directory structure

  • main.go - code
  • schema.prisma - prisma schema
  • migrations - prisma auto generated migrations
  • db - prisma auto generated db package
  • fiber.sqlite3 - session storage
  • data.db - prisma user storage

Routes

By default the application runs on port 3000.

POST /signup (signs up a user)

Body:

{
    "username": string,
    "password": string
}

POST /login (logs in a user)

Body:

{
    "username": string,
    "password": string
}

Returns HTTP 201

GET /protected (returns a users ID)

Returns HTTP 200, user ID

About


Languages

Language:Go 100.0%