Skip to content

Asura409/fiberBlogpostAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ Simple Blog Post API with GoFiber

This is a basic RESTful API built using Go and the Fiber web framework. It provides CRUD operations for managing blog posts using an in-memory fake database (slice of structs).


๐Ÿš€ Features

  • Add a new post
  • Edit an existing post
  • Get all posts
  • Get a post by ID
  • Delete a post

๐Ÿ“ฆ Tech Stack


๐Ÿ“ Project Structure


.
โ”œโ”€โ”€ main.go          # Main application file
โ”œโ”€โ”€ go.mod           # Go module definition
โ””โ”€โ”€ README.md        # This file


๐Ÿ›  Setup Instructions

1. Clone the Repository

git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name

2. Initialize Go Module (if not already done)

go mod init github.com/yourusername/your-repo-name

3. Install Dependencies

go get github.com/gofiber/fiber/v2

4. Run the Server

go run main.go

Server will start on http://localhost:8080


๐Ÿ“ฎ API Endpoints

Method Endpoint Description
POST /posts Create a new post
PUT /posts/:id Update a post by ID
DELETE /posts/:id Delete a post by ID
GET /posts Get all posts
GET /posts/:id Get a specific post

๐Ÿ“ฆ Sample Post JSON Format

{
  "id": 1,
  "author": "Jane Doe",
  "title": "My First Post",
  "content": "This is the content of the post."
}

โš ๏ธ Notes

  • This app uses an in-memory slice to store posts โ€” data is lost on server restart.
  • This is intended for learning and prototyping. For production use, integrate a proper database (PostgreSQL, MongoDB, etc.)

๐Ÿง  Next Steps

  • Add persistent storage (e.g., PostgreSQL)
  • Add request validation
  • Add Swagger/OpenAPI docs
  • Add tests using Go's testing package

๐Ÿค Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what youโ€™d like to change.


๐Ÿ“„ License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages