Skip to content

It is a sample blog application implemented by using the go-with-fiber framework.

Notifications You must be signed in to change notification settings

muthukumar89uk/go-simple-blogs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog Project

This is a simple blog project implemented in Go (Golang) using the Fiber web framework and GORM as the ORM library for interacting with the database. The project allows users to sign up, log in, post articles, add comments to articles, view articles, and manage user sessions using JWT (JSON Web Tokens) for authentication.

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/muthukumar89uk/go-simple-blogs.git
    

Click here to directly download it.

Install dependencies:

      go mod tidy

Run the Application

  1. Run the Server

       go run .
    
  2. The server will start on http://localhost:8000.

Technologies used

The project is built using the following technologies:

  • Golang : The backend is written in Go (Golang), a statically typed, compiled language.
  • Fiber : The Fiber web framework is used to create RESTful APIs and handle HTTP requests.
  • JWT : JSON Web Tokens are used for secure user authentication and authorization.
  • bcrypt : Passwords are stored securely in hashed form using the bcrypt hashing algorithm.
  • Postgres: Here, users data and Post articles data are handled in Postgres SQL.

Project Structure

The project is organized into several packages, each responsible for specific functionalities:

  • handlers : Contains the HTTP request handlers for different API endpoints.
  • logs : Custom package for logging.
  • middleware: Custom middleware for handling authentication and authorization.
  • models : Defines the data models used in the application.
  • repository: Contains functions for interacting with the database.
  • drivers : Contains functions for establish a connection to database.
  • helper : Custom package that contains all the constants.

Project Explanations

Signup: Allows users to sign up by providing their signup credentials. Passwords are securely hashed using bcrypt before storing them in the database.

Login: Users can log in using their registered email and password. Successful login generates a JWT token that is sent back to the client for further authenticated requests.

Post Article: Authenticated users can create and post articles. The articles are associated with the logged-in user and a category.

Get Articles: Users, both authenticated and unauthenticated, can view all articles available in the system.

Get Articles by User: Authenticated users can retrieve articles posted by a particular user.

Get Article by ID: Allows retrieval of a specific article based on its ID.

Update Article: Authenticated users can update their own articles by providing new content.

Delete Article: Authenticated users can delete their own articles.

Add Comment: Authenticated users can add comments to articles.

Get Comments by Article: Allows retrieval of all comments associated with a specific article.

Edit Comment: Authenticated users can edit their own comments.

Delete Comment: Authenticated users can delete their own comments.

Logout: Authenticated users can log out, and their JWT tokens are invalidated.

Note

  • The project uses the Fiber web framework for handling HTTP requests.here.

About

It is a sample blog application implemented by using the go-with-fiber framework.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages