NewsServer is HTTP server that implements REST backend API. It provides service with typical news site functionality.
Previously you must install libpq-dev
package.
git clone https://github.com/catdarick/NewsServer
cd NewsServer
stack install
mkdir -p /home/$USER/configs && cp ./templates/server.cfg $_
Set PostgreSQL connection info in /home/<user>/configs/server.cfg
.
# Create tables in PostgreSQL database
# Needs to be done once
NewsServer-exe -i
#Create admin account if it's necessary
NewsServer-exe -a login password firstName lastName
# Run server
NewsServer-exe
Closed endpoints require a valid Token to be included in the header of the request. A Token can be acquired from the Login view above.
- Create account :
POST /createAccount
- Get token :
PUT /getToken
Each endpoint displays information related to some entity
- Get users :
GET /getUsers
- Get authors :
GET /getAuthors
- Get tags :
GET /getTags
- Get categories :
GET /getCategories
- Get drafts :
GET /getDrafts
- Get news :
GET /getNews
- Get comments :
GET /getComments
Each endpoint displays information related to some entity
- Create account :
POST /createUser
- Create author :
POST /createAuthor
- Create tag :
POST /createTag
- Create category :
POST /createCategory
- Create draft :
POST /createDraft
- Create news by publishing draft :
PUT /publishDraft
- Create comment :
POST /createComment
Each endpoint displays information related to some entity
- Edit author :
PUT /editAuthor
- Edit tag :
PUT /editTag
- Edit category :
PUT /editCategory
- Edit draft :
PUT /editDraft
Each endpoint displays information related to some entity
- Delete user :
DELETE /deleteUser
- Delete author :
DELETE /deleteAuthor
- Delete tag :
DELETE /deleteTag
- Delete category :
DELETE /deleteCategory
- Delete draft :
DELETE /deleteDraft
- Delete news :
DELETE /deleteNews
- Delete comment :
DELETE /deleteComment