- CRUD news.
- CD comment.
HTTP | URL | BODY | RESPONSE |
GET | /api/v1/news | - |
[
{
"id": 3,
"title": "Title",
"description": "Desc",
"comments": null
},
{
"id": 4,
"title": "kek",
"description": "Desc",
"comments": null
}
] |
POST | /api/v1/news |
{
"title": "Test"
} |
{
"id": 5,
"title": "Test",
"description": "",
"comments": null
} |
GET | /api/v1/news/{id} | - |
{
"id": 4,
"title": "kek",
"description": "Desc",
"comments": [
{
"id": 13,
"text": "Text",
"news_id": 4
}
]
} |
DELETE | /api/v1/news/{id} | - |
{
"id": 5,
"title": "Test",
"description": "",
"comments": null
} |
PUT | /api/v1/news/{id} |
{
"title": "Test"
} |
{
"id": 4,
"title": "Test",
"description": "Desc",
"comments": null
} |
POST | /api/v1/comments |
{
"text": "Text",
"news_id": 4
} |
{
"id": 14,
"text": "Text",
"news_id": 4
} |
DELETE | /api/v1/comments/{id} | - |
"Comment Deleted Successfully!" |
- Language: Go
- Libraries: Viper, GORM, Mux
- Database: MySQL
Firstly clone the project.
git clone https://github.com/l1ve4code/go-news-api
Secondly run project.
go run .
- Telegram: @live4code
- Email: steven.marelly@gmail.com