Skip to content

An API template using gofiber implementing CRUD and JWT route protection

Notifications You must be signed in to change notification settings

rizaldyaristyo/gofiber-api-boiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDL

CREATE DATABASE task_db;

USE task_db;

CREATE TABLE tasks (
 id INT AUTO_INCREMENT PRIMARY KEY,
 title VARCHAR(255) NOT NULL,
 description TEXT NOT NULL,
 status VARCHAR(50) NOT NULL
);

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(255) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL
);

-- in case i forgot
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* to 'username'@'%';

Restore DB

# mysqldump -u username -ppasword task_db > db.sql
mysql -u userame -ppassword task_db < db.sql

Run

# go get github.com/gofiber/fiber/v2 github.com/go-sql-driver/mysql github.com/joho/godotenv
go mod tidy
go run main.go

etc in case i forgot

go mod init rizaldyaristyo-fiber-boiler

About

An API template using gofiber implementing CRUD and JWT route protection

Resources

Stars

Watchers

Forks

Languages