Categorygithub.com/RakibSiddiquee/golang-gin-jwt-auth-crud
modulepackage
0.0.0-20230820195223-1e3e09957b03
Repository: https://github.com/rakibsiddiquee/golang-gin-jwt-auth-crud.git
Documentation: pkg.go.dev

# README

Golang, Gin framework, GORM, Postgres, JWT auth and CRUD Application

Used Packages:

  1. Gin Framework
  2. Postgres
  3. GORM
  4. Golang JWT (https://github.com/golang-jwt/jwt)
  5. Godotenv (https://github.com/joho/godotenv)
  6. Validation (https://github.com/go-playground/validator)
  7. Slug (https://github.com/gosimple/slug)

Steps to follow

  1. Clone the repo
  2. Run the command go mod download
  3. Rename the .env.example file to .env
  4. Create a database in postgres
  5. Change the DNS value in .env file
  6. Run the command go run db/migrate/migrate.go (Drop existing tables and recreate those)
  7. Check your database, tables should be available
  8. Run the project using the command go run main.go
  9. Test the application in Postman

Routes

  1. http://localhost:3000/api/signup (Signup)
{
   "name": "John Doe",
   "email": "[email protected]",
   "password": "123456"
}
  1. http://localhost:3000/api/login (Login)
{
  "email": "[email protected]",
  "password": "123456"
}
  1. http://localhost:3000/api/logout (Logout)
  2. http://localhost:3000/api/categories/create (Create category)
{
  "name": "National"
}
  1. http://localhost:3000/api/categories (Get all category)
  2. http://localhost:3000/api/categories/1/edit (Edit category)
  3. http://localhost:3000/api/categories/1/update (Update category)
{
  "name": "Sports"
}
  1. http://localhost:3000/api/categories/1/delete (Soft delete a category)
  2. http://localhost:3000/api/categories/all-trash (Get all trashed category)
  3. http://localhost:3000/api/categories/delete-permanent/1 (Delete a trashed category permanently)
  4. http://localhost:3000/api/posts/create (Create post)
{
  "title": "Awesome post",
  "body": "This is the awesome post details",
  "categoryId": 1
}
  1. http://localhost:3000/api/posts (Get all post)
  2. http://localhost:3000/api/posts/1/show (Show a single post)
  3. http://localhost:3000/api/posts/1/edit (Edit post)
  4. http://localhost:3000/api/posts/1/update (Update post)
{
  "title": "Hello World",
  "body": "This is the hello world post details",
  "categoryId": 1
}
  1. http://localhost:3000/api/posts/1/delete (Soft delete a post)
  2. http://localhost:3000/api/posts/all-trash (Get all trashed post)
  3. http://localhost:3000/api/posts/delete-permanent/1 (Delete a trashed post permanently)
  4. http://localhost:3000/api/posts/1/comment/store (Comment on a post)
{
  "postId": 1,
  "body": "This is a comment"
}
  1. http://localhost:3000/api/posts/1/comment/1/edit (Edit a comment)
  2. http://localhost:3000/api/posts/1/comment/1/update (Update a comment)
{
  "postId": 1,
  "body": "This is a updated comment"
}
  1. http://localhost:3000/api/posts/1/comment/1/delete (Delete a comment)

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author