Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.68 KB

README.md

File metadata and controls

54 lines (36 loc) · 1.68 KB

Spring Boot "JWT Authentication" roles based

alt text

Simple Restful CRUD API using Spring Boot, Postgresql, JPA and Hibernate, Spring Security.

Steps to Setup

1. Clone the application

git clone https://github.com/majiedo/Spring-Boot-REST-API.git

2. Spin up Postgresql database

docker-compose up

3. Create .env file in root directory

SECRET_KEY=SuperSecretKey!

4. Run the app using maven

mvn spring-boot:run

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

Explore Rest APIs

The app defines following CRUD APIs.

Auth

Method Url Description Sample Valid Request Body
POST /api/auth/register Creating an account ( name, email, password ) JSON
POST /api/auth/login Login in to an account ( email, password ) JSON

Users

Method Url Description Sample Valid Request Body
GET /api/users/ Get All users
Get /api/users/{userId} Get user
Post /api/users/{userId} Create a user ( only for admin ) ( name, email, password ) JSON
Patch /api/users/{userId} Update a user ( only for admin ) ( name, email, password ) JSON
Delete /api/users/{userId} Delete a user ( only for admin )