Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Latest commit

 

History

History
107 lines (84 loc) · 4.05 KB

README.md

File metadata and controls

107 lines (84 loc) · 4.05 KB

🎥 FilmLand

Java Spring

Description:

The Filmland API Backend allows performing following operation. Equipped with 🔐 Stateless REST JWT based Bearer token authentication

  • Get all available categories for subscription in FilmLand
  • Subscribe to category
  • Share your subscription
  • Create User
  • Login with user details

🛡️ Code coverage

image

⚖️ Assumptions :

  • Validations for users
    • username and password should be at least 8 characters long.
  • Validations for Subscriptions
    • email should be same as logged in users email
    • customer can be left empty
    • Only a person who subscribed intially can share that subscription with other user
    • One user can subscribe to any category only once

🛠️ Tech-Stack

Java Docker Spring

  • Java 8
  • Spring-Boot
  • JPA
  • In-Memory Database H2
  • Maven
  • Git bash

📝 Steps to run the application

  • Checkout the code / Download from git repo()
  • checkout : open git bash and run command git clone https://github.com/Abhinav2510/FilmLand.git
  • Option 1: Maven way of running
    • open command prompt(cmd) or terminal on Mac
    • navigate to the project folder
    • run command mvn clean install
    • once its successfully build run command mvn spring-boot: run

Now application is up and running on http://localhost:8080

❔ How to use this service

  • Open the URL in your browser : http://localhost:8080
  • User will see a swagger page with all the defined specs of the service.
  • There will have 2 Tags you can see.

1. user-controller

Description:

  • Endpoint 1: POST /users/signup
    • Allows creation of user
  • Endpoint 2: POST /users/signin
    • Allows user to login
    • On providing correct credential in request the response provides Bearer token in header which can be used for calling further API

2. film-category-controller

Description:

  • All the below endpoints are secured with stateless JWT authentication.
  • All request to below Endpoints should contain custom header authorization with value containing Bearer {JWT}
  • Endpoint 1:POST /categories/
    • subscribe to category or share subscription with another user
  • Endpoint 2: GET /catefories/
    • get all the available categories and subscribed available for subscriptions

🧪 Testing using Swagger UI

####Running application

Authenticating for using FilmLand API

  • under user-controller tab you can create user or use already created user to authenticate
  • to create user use /users/signup endpoint
  • to Use default user for application use below JSON object for user/signin
  {
  "email":"user@test.com",
  "password":"password1234"
  } 
  
  {
  "email":"user2@test.com",
  "password":"password1234"
  } 
  
  • It will return response header authorization with JWT token
  • Screenshot 2021-09-23 at 00 35 49
  • Copy the value in authorization header
  • On top left corner click on Authorize button and enter copied value
  • image

Now you should be able to call all the APIs without needing to specify authorization header manually