Code Monkey home page Code Monkey logo

simple-blog-api's Introduction

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.  

simple-blog-api's People

Contributors

starving-array avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.