recipes/todo-app-with-auth-gorm
Todo App + Auth + GORM
A Todo application with authentication using GORM.
Todo App with Auth using GORM
This project demonstrates a Todo application with authentication using GORM.
Prerequisites
Ensure you have the following installed and available in your GOPATH:
Installation
Clone the repository:
git clone https://github.com/gofiber/recipes.git cd recipes/todo-app-with-auth-gormInstall dependencies:
go getCreate the environment file and add a secret for signing the JWTs.
airloads.env, and the application refuses to start withoutTOKEN_KEY:cp .env.example .env echo "TOKEN_KEY=$(openssl rand -hex 32)" >> .env
Running the Application
- Start the application:
air
Environment Variables
| Variable | Description | Default |
|---|---|---|
PORT | Server listening port | 5000 |
DB | Name of the SQLite database file | gotodo.db |
TOKEN_KEY | Secret used to sign the JWTs. Generate a random one with openssl rand -hex 32 | required |
TOKEN_EXP | Token lifetime, a time.ParseDuration string | 10h |