Skip to content

This is a simple blog application which generates REST API. User can sign up and sign in. Search other user and follow them. Create post and comment on posts.

Notifications You must be signed in to change notification settings

starving-array/Simple-Blog-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blog-api

This is a springboot project which can genarate REST API for blog.

You can,

  1. Create a User account.
  2. Update your account details.
  3. Login to your account.
  4. Search for a friend by his/her name.
  5. Follow / Unfollow a friend.
  6. Create a blog post.
  7. Delete a post.
  8. Add comments on posts.
  9. Edit comments.
  10. Delete your comments.

How to use?

As this is a rest API project, client part hasn't added to it. But you can use Swagger or Postman to play with the API. And also you can use this API with your frontend project. As it will be on localServer on your PC you need to keep the server on while playing with it. Steps given below for additional info,

1. CREATE database blogApp;

Create a database on your local system. If you don't have MySQL installed, kindly install it first.

Once Installed please set/keep your mysql credentials as below

username: root
password: root

and create the database as mentioned above. Database name-> blogApp;

2. git clone https://github.com/starving-array/blog-api.git;

Clone this repo to your local system and open STS to import and run the project. If you don,t have STS IDE on your system, kindly download STS.

3. Open STS and Import the Project;

File -> Open Projects from File Systems -> Directory

  • Browse to the location where you have cloned this project. And select blog-api

Next-> Finish. It might take a few minutes to download all the dependencies on your local system. You can check the progress bar at righ-down corner.

Once finished update the Maven project to make sure all the dependencies have downloaded.

Right Click on blog_api at package exporer on leftside window, Maven -> Update Project -> check Force Update on SnapShots/releases -> Ok

Congratulation, you've successfully imported the project on your system

4. Start the Spring Boot App Server;

Right Click on blog_api at package exporer on leftside window, Run as -> Spring Boot App

You can see the process as a console window will be opening below.

5. http://localhost:8080/swagger-ui/;

Open this link on broswer. It will open the Swagger UI. You can play with All the API there.

6. STOP the server;

Once you are done with playing, click on the red square box on top of the console to stop the server.

Important Facts,

  1. The port for this application has set 8080. You can change it from Application Properties in resource folder, or stop any other running app before starting this as it can create conflict for same port that you might be using coincedently.

#changing the server port
server.port=8080

  1. _Incase if have different root name and password for mysql in your system, you change this application username and password from Application Properties.

# MySql username and Password
spring.datasource.username=root
spring.datasource.password=root

API names and Use=>

**UUID used as security param to authenticate user and maintain security.

1. User-controller:

  • createAccountH : Create a new account.
  • updateAccountH : Modify your account
  • searchUserByNameH : Search for a friend by name.
  • followUser : Follow a User
  • unFollowUser: Unfollow a User

1.1 LOGIN:
  • logInUser : Login with Contact No and Password. This will genarate a UUID to control activity and it will also maintain security.
  • logoutUser : Session will be deleted, (UUID) once you have logged out.
  • getAccountDetails : With UUID and account id as parameters, it will match if the user is same and return user detail.

2.Connection:

  • getFollowing : With userId param of user A this will return a list of Users, user A is following.
  • getFollower : With userId param of user A this will return a List of Users, who follows user A.

3.Post:

  • createPostH : Create a new post.
  • updatePostH : Modify post.
  • getAllPostH : Get all post from database.
  • getPostById : Get a post by id param.
  • deletetePostH : Delete a post.
  • getPostByPage : Pagination. By default the post per page has been set to 10. And by passing the pageno as param, this will return List of post for that page.
  • getTotalPostSize : Return total post count.

4.Comment:

  • createNewCommentH : Create a new comment on a post.
  • updateCommentH : Modify comment.
  • getAllCommentByPost : Get a List of comments for a post.
  • getCommentById : Get a comment by id.
  • deleteCommentH : Delete a comment.

PostRating, Sorting, And Tags will be updated soon.  

About

This is a simple blog application which generates REST API. User can sign up and sign in. Search other user and follow them. Create post and comment on posts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages