Coder Social home page Coder Social logo

examensarbetebackend's Introduction

Examarbetet Hongwei Han

This project aims to generate a demo by which users can check hotel information and book hotel.

image1

Prerequisites

  • Alibaba Nacos

docker run --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:v2.2.0

  • Mysql

docker compose -f docker-compose-mariadb.yml up

  • Elastic search

docker compose -f docker-compose-elasticsearch.yml up

Micoservices

  • User Information Service

The program uses MyBatis to create, select, update, and delete user information in the MySQL table tb_userInfo. MyBatis automatically converts snake_case to camelCase. Data from the repository is updated in the service section and is exposed at the endpoint /user.

  • Order Information Service

The program applies similar methods in the order information service. When users review order information, the program retrieves user information through the OpenFeign service.

  • Elasticsearch Service

The program uses spring-boot-starter-data-elasticsearch to connect to Elasticsearch. It applies JPA to select hotel information.

  • Authentication Service

Based on the user information database, the program generates and decodes tokens. The endpoint /auth/login generates tokens, while the endpoint /test/protected ensures the service functions correctly. Additionally, the program deciphers passwords using the JWTProvider method.

  • Gateway Service

Users can access different services through the same address and port. The gateway service also handles load balancing. The endpoint /auth/login is directly exposed so users can visit it without a token. For other endpoints, users need to provide a token.

  • OpenFeign Service

The program uses spring-cloud-starter-openfeign to configure OpenFeign. With OpenFeign, the user information service endpoint is internally exposed. Meanwhile, feign-httpclient delivers the endpoint to the order information service. This enables the order information service to display user information.

Results

  • Endpoints Endpoints

With gateway and Oauth2

  • Login in order to get token

Login

  • Without token the response is error Error

  • With token, the program gets user information, abc.

UserInfo

  • With token the program gets order information in response to the user information

OrderInfo_1

OrderInfo_2

  • Research the data from elastic search

ES_1

WS_2

Limitation

  • RabbitMQ
  • Redis
  • Deployment

examensarbetebackend's People

Contributors

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