https://github.com/luiggy102/go-blog-api
📚 REST-API for post management
https://github.com/luiggy102/go-blog-api
api api-rest docker docker-compose go golang mongodb rest-api
Last synced: 2 months ago
JSON representation
📚 REST-API for post management
- Host: GitHub
- URL: https://github.com/luiggy102/go-blog-api
- Owner: Luiggy102
- Created: 2025-01-24T15:37:51.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-28T07:04:54.000Z (3 months ago)
- Last Synced: 2025-02-28T12:58:33.543Z (3 months ago)
- Topics: api, api-rest, docker, docker-compose, go, golang, mongodb, rest-api
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-blog-api
go-blog-api is a **REST API** project for create, read, update and delete posts (CRUD operations). It uses a **Go** backend and a **Mongo** database for storing the data.
Also can be run with Docker.## Base url
```
http://localhost:8080/
```##### Run it with [Go] (Need running MongoDB with a db called *go_blog*).
```
git clone https://github.com/Luiggy102/go-blog-api.git
cd go-blog-api
go run main.go
```##### Run it with [Docker]
```
git clone https://github.com/Luiggy102/go-blog-api.git
cd go-blog-api
docker compose up
```## Endpoints
`GET /`: Shows a welcome message`GET /posts`: List the firsts posts
`GET /posts/{id}`: Get the post info by the post ID
`GET /posts?page=2`: Pagination feature to see posts
`POST /posts`: Insert a post in JSON format
Example:
```json
{
"post_title": "post title"
"post_content": "sample text"
}```
`PUT /posts/{id}`: Update the post using the post ID, receive a JSON with the content to be updated
```json
{
"post_title": "new post title"
"post_content": "update text"
}
````DELETE /posts/{id}`: Delete the post using the post ID