https://github.com/pycomet-zz/hacker-news-app
https://github.com/pycomet-zz/hacker-news-app
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pycomet-zz/hacker-news-app
- Owner: Pycomet-zz
- License: mit
- Created: 2022-09-21T18:40:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-26T19:11:03.000Z (over 2 years ago)
- Last Synced: 2024-10-05T22:04:59.138Z (8 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hacker News Miniblog Project
This project is aimed at synchronizing with the live hacker news api to provide a smooth interactive space for a user to search all the news content based on their preferred text keywords or possibly by the news type.
Below are the avaialable Restful endpoints from this flask application;
## Fetch All News Items From Database
Used to fetch all the data avaialable in the database in order of the newest entries being at the top.
**URL** : `/api/v1/news`
**METHOD** : `GET`
### Success Response
**Code** : `200 OK`
**Content example**
```json
{
"message": "Fetch successfull",
"data": [], // Data in a list
"code": 200
}
```## Fetch All News Items By Filter (by text or type )
Used to fetch data avaialable in the database based on text search or by the news type (story, job or poll).
**URL** : `/api/v1/news`
**METHOD** : `POST`
**PARAMS** :
```json
{
"search": "Query string to search",
"types": "news types seperated by ',' "
}
```### Success Response
**Code** : `200 OK`
**Content example**
```json
{
"message": "Fetch successfull",
"data": [], // Data in a list
"code": 200
}
```## Fetch Single Item From Database
Used to fetch a single news data from the database.
` is unique news id`
**URL** : `/api/v1/news/`
**METHOD** : `GET`
### Success Response
**Code** : `200 OK`
**Content example**
```json
{
"message": "Item Fetch Success",
"data": item, // Data object
"code": 200
}
```## Create New Item To Database
Used to create/write a new data into database with a new unique id.
` is not neccessarily valid`
**URL** : `/api/v1/news/`
**METHOD** : `POST`
**PARAMS** :
```json
{
"by": "codefred",
"type": "job",
"time": 2436273623,
"deleted": false,
"dead": false,
"text": "This is a test job",
"url": "https://google.com",
"title": "Flow design"
}
```### Success Response
**Code** : `200 OK`
**Content example**
```json
{
"message": "New Item Created",
"data": true, // (Bool) created data
"code": 200
}
```## RUN ALL TESTS
This command run all the three (3) scripts to validate all the app functions to be working fine.
**COMMAND** : `python -m unittest tests`
## Creator
Codefred - https://codefred.me