Methods
(async, inner) deleteNewsEntry(request, response)
Delete news specified by Un*x Timestamp
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
request |
Object |
Properties
|
||||||
response |
Object |
- Source:
Returns:
result is logged into console
Example
$ curl -X DELETE \
http://localhost:3001/api/news?target=0
// Delete news posted on Un*x Epoch
(async, inner) getNewsEntry(request, response) → {JSON}
Get single news entry specified by Un*x Timestamp
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
request |
Object |
Properties
|
||||||
response |
Object |
- Source:
Returns:
news entry data
- Type
- JSON
Example
$ curl -X GET http://localhost:3001/api/news?target=0
// gets news posted on Un*x epoch in JSON format
(async, inner) getNewsList(request, response) → {string}
Get news list in HTML table body tr+td
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | |
response |
Object |
- Source:
Returns:
HTML table body tr+td
- Type
- string
Example
$ curl -X GET \
http://localhost:3001/api/news/list
// <tr>
// <td>1</td>
// <td>1970/1/1 0:0:0</td>
// ...
// </tr>
// ...
(async, inner) getNewsListUnrwapped(request, response) → {JSON}
Get news list in unformated raw JSON string
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | |
response |
Object |
- Source:
Returns:
Unformatted JSON string that contains news entries
- Type
- JSON
Example
$ curl -X GET \
http://localhost:3001/api/news/list-unwrapped
// gets raw JSON containing news entries
(async, inner) postNewsEntry(request, response)
Post news and write to database
Parameters:
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
Properties
|
||||||||||||||||||
response |
Object |
- Source:
Returns:
result is logged into console
Example
$ curl -X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-raw 'entryType=1&cardContent=Test&article=&linkPath=&coverImagePath=/default.png' \
http://localhost:3001/api/news
// Posts Tweet style news with content "Test" and cover image "/default.png"
(async, inner) putNewsEntry(request, response)
Update news entry
Parameters:
| Name | Type | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
Properties
|
|||||||||||||||||||||
response |
Object |
- Source:
Returns:
result is logged into console
Example
$ curl -X PUT \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-raw 'target=0&entryType=1&cardContent=Test&article=&linkPath=&coverImagePath=default.png' \
http://localhost:3001/api/news
// Update news posted on Un*x Epoch with given contents