Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hansyagarwal/news-api
News-API for Appointy online test
https://github.com/hansyagarwal/news-api
api golang postman
Last synced: about 2 months ago
JSON representation
News-API for Appointy online test
- Host: GitHub
- URL: https://github.com/hansyagarwal/news-api
- Owner: hansyagarwal
- Created: 2020-11-07T18:16:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-09T16:39:38.000Z (about 4 years ago)
- Last Synced: 2023-03-08T10:20:29.675Z (almost 2 years ago)
- Topics: api, golang, postman
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# news-api
## Requirements
- Postman
- Go ver 1.4 or later
- Text editor (VSCode recommended)## What operations it can do?
- Create an Article
- Get an Article by it's id
- List/Get all the Articles
- Search for an artice by it's title,subtitle or content## How to run?
import/download all package and libraries using `go get`
```
go run main.go
```
> port: 3000> everything is case-sensitive
> the mongodb uri is kept public for some time
open postman and create new request
### for creating an article,
switch from GET to POST and type `localhost:3000/articles`
select `body` and then `raw` and for example type
```
{
"Title": "news article",
"Subtitle": "subtitle of new article",
"Content": "content of new article"
}
```
click send### for other operations,
switch to GET and type:
`localhost:3000/articles` to list all the articles`localhost:3000/articles/` to get the article by its id (try `5fa96b181aff7c9b9bb04e8a` as id or put `localhost:3000/articles/5fa96b181aff7c9b9bb04e8a`)
`localhost:3000/articles/search?q=` to get the article by its title/subtitle/content (if the title is more than 1 word use `%20` for space, eg: `localhost:3000/articles/search?q=Covid19%20vaccine`)