GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - youngInnovator/Blog-RestAPI: Rest API using Spring Rest with Junit

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.mvn/wrapper
.mvn/wrapper
 
 
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Blog - Rest API

Simple Restful CRUD API for Blog for POC or demo

Technologies used

  • Spring Boot
  • Spring Rest
  • Spring Data
  • MySQL database for persistent

Requirements

  1. Java - 1.8.x
  2. Maven - 3.x.x
  3. MySQL - 5.x.x

Steps to Setup

1. Clone the application

  • clone this project into your local directory: git clone https://github.com/youngInnovator/Blog-RestAPI.git

2. Create MySQL database

In order to achieve persistence this project relies on MySQL.

MySQL version 5.6 or better. If you have Docker installed it might be useful to run the database as a container.

Create the database for MySQL using following steps.

mysql> create database db_blog; -- Create the new database
mysql> create user 'blog'@'localhost' identified by 'blog'; -- Creates the user
mysql> grant all on db_example.* to 'blog'@'localhost'; -- Gives all the privileges to the new user on the newly created database

3. Change MySQL username and password as per your installation

  • open src/main/resources/application.properties
  • change spring.datasource.username and spring.datasource.password as per your MySQL installation (if required)

4. Build and run the app using maven

  • Build the project:
mvn clean install
  • Run the blog project:
java -jar blog-0.0.1-SNAPSHOT.jar

Alternatively, you can run the app without packaging it using -

mvn spring-boot:run

The app will start running at http://localhost:8080.

Run unit test

mvn test

Explore Rest APIs

The app defines following CRUD APIs.

  1. Get all posts
GET /blog/post/
  1. Get specific post
GET /blog/post/{postId}
  1. Add new post
POST /blog/post/
  1. Update existing post
PUT /blog/post/
  1. Delete specific post
DELETE /blog/post/{postId}
  1. Get specific post comments
GET /blog/post/{postId}/comments
  1. Add new comment to specific post
POST /blog/post/{postId}/comment
  1. Get specific comment
GET /blog/comment/{commentId}
  1. Like specific comment
POST /blog/comment/{commentId}/like
  1. Update existing comment
PUT /blog/comment/
  1. Delete specific comment
DELETE /blog/comment/{postId}

About

Rest API using Spring Rest with Junit

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.