Coder Social home page Coder Social logo

ravening / image-microservices-spring-boot Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 67 KB

Microservices in Java implemented using Spring boot and Spring Cloud

Java 100.00%
java microservices spring-boot spring-cloud spring-cloud-config spring-cloud-netflix spring-cloud-eureka jwt jwt-authentication hysterix

image-microservices-spring-boot's Introduction

Image microservices using Java

This is a sample image microservice developed using Spring Boot Spring Cloud and Java

Description

This contains an image service which stores the IMDB images.
The gallery service fetches the details from image service.
Authentication service provides authentication and authorization using JWT Zuul service provides client side load balancing.

For more details, refer to https://medium.com/omarelgabrys-blog/microservices-with-spring-boot-intro-to-microservices-part-1-c0d24cd422c3

Getting started

1 . Clone the respository

2 . Start the below services in order

Start the eureka server
cd eureka-server
./mvnw spring-boot:run


Start the image service

cd image-service
./mvnw spring-boot:run

You can start multiple instance of image service using
java -jar -Dserver.port=<> target/image-service-*.jar

Start the gallery service

cd gallery-service
./mvnw spring-boot:run

You can start the second instance of gallery service using
java -jar -Dserver.port=8300 target/gallery-service-*.jar

Start the auth service

cd auth-service
./mvnw spring-boot:run

Finally start the zuul-server

cd zuul-server
./mvnw spring-boot:run

3 . Once all the services are started successfully, make sure they are registered with
eureka server by navigating to

http://localhost:8761

4 . In order to access the service, first you need to get the JWT by providing your credentials
I have stored two users in the file UserDetailsServiceImpl.java.
Send a POST request to below link with the following body

http://localhost:8762/auth

Body should be

{
    "username": "<one of the username from the above java file>"
    "password": "password for that user"
}

If you are authenticated successfully, you should receive a JWT in the header.
Copy just the encrypted token without including "Bearer" keyword.

5 . Now to access the endpoints you need to pass this encrypted token in the header

6 . In postman create a new get request for the below end point

http://localhost:8762/gallery/1

Authorization should be "Bearer Token" and paste the above copied token in the "Token" field

Built With

  • Maven - Dependency Management

Authors

image-microservices-spring-boot's People

Contributors

ravening avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.