A simple twitter like web app, where user can create, update and delete their own post and view other users posts.
General requirements
- npm
- composer
Note: clone this inside your webserver's directory
1.Cloning the repository
git clone https://github.com/PaoGon/Blog.git
2.Installing frontend dependencies
cd Blog/frontend
npm install
3.Installing backend dependencies
cd ../backend
composer install
Make sure you installed all of the required dependencies
cd ../frontend
npm run start
GET /api/get_posts
Parameter | Type | Description |
---|---|---|
JWT token |
string |
Required. Users Authorization token/JWT token |
returns all posts of all the existing users from latest to oldest JSON data with success(0 or 1), HTTP response code, data(JSON {id, title, content, date created })
GET /api/get_own_posts?user_id=${user_id}
Parameter | Type | Description |
---|---|---|
JWT token |
string |
Required. Users Authorization token/JWT token |
user_id |
int |
Required. ID of the user to fetch with |
returns all posts of the user from latest to oldest posts this called when viewing the users timeline JSON data with success(0 or 1), HTTP response code, data(JSON {id, title, content, date created })
POST /api/create_post
Parameter | Type | Description |
---|---|---|
JWT token |
string |
Required. Users Authorization token/JWT token |
user_id |
int |
Required. ID of the user to fetch with |
title |
string |
Required. Title of the post |
content |
string |
Required. Content of the post |
returns a JSON data with success, HTTP response code, message(successfull, failed or Method not Allowed)
PUT /api/update_post
Parameter | Type | Description |
---|---|---|
JWT token |
string |
Required. Users Authorization token/JWT token |
post_id |
int |
Required. ID of post to update |
user_id |
int |
Required. ID of the user to query with |
title |
string |
Required. Title of the post |
content |
string |
Required. Content of the post |
returns a JSON data with success, HTTP response code, message(successfull, failed or Method not Allowed)
DELETE /api/update_post
Parameter | Type | Description |
---|---|---|
JWT token |
string |
Required. Users Authorization token/JWT token |
post_id |
int |
Required. ID of post to delete |
user_id |
int |
Required. ID of the user to query with |
returns a JSON data with success, HTTP response code, message(successfull, failed or Method not Allowed)
POST /api/accounts/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Users Email |
password |
string |
Required. Users Password |
returns the Authorization bearer key or the JWT token
POST /api/accounts/signup
Parameter | Type | Description |
---|---|---|
username |
string |
Required. Users username |
email |
string |
Required. Users Email |
password |
string |
Required. Users Password |
returns a JSON data with success, HTTP response code, message(successfull, failed or Method not Allowed)