Skip to content

Demo application with Spring Boot and ReactJS, bootstrapped with JHipster and create-react-app

License

Notifications You must be signed in to change notification settings

gzheyts/productsapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License: MIT

ProductsApp

Screenshot from running application

About

This demo project was bootstrapped with create-react-app, spring-boot-v2 and also jhipster.

Try deployed instance with Heroku productsapp

Goals

The main goal is to integrate various technologies and principles in a single full-stack application.

Dependencies

Backend

Frontend

Overview

Clone project with

    git clone github.com/gzheyts/productsapp <project_root>

Running application

mvn -f <project_root>/pom.xml spring-boot:run 

Then navigate to localhost:8080

Running API

mvn -f <project_root>/pom.xml spring-boot:run -Dskip.yarn

This will run api on localhost:8080/api

Running Frontend dev server

cd <project_root>/src/main/webapp
yarn start

Will run frontend dev server at localhost:3000

Running server-side tests

To launch application's tests, run:

mvn -f <project_root>/pom.xml test -Dskip.yarn

API usage examples httpie

Register user request

http POST :8080/users/register username="user" password="password"

response

HTTP/1.1 200 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: 0
Expires: 0
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

Obtain JWT auth token for registered user

http POST :8080/login username="user" password="password"

response

HTTP/1.1 200 
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MzMxOTgxNTYsInN1YiI6InVzZXIifQ.zvw99k1_Nh1UTNI6ZCBHL3v6-boXvuiyBNEcFM2LVhW0Rc6pAN7lEEJpXcSsOrJy0_9ifzgcJvCJTE9C1hW-ig
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: 0
Expires: 0
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

Access protected resources

http :8080/api/categories Authorization:"Bearer eyJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MzMxOTgxNTYsInN1YiI6InVzZXIifQ.zvw99k1_Nh1UTNI6ZCBHL3v6-boXvuiyBNEcFM2LVhW0Rc6pAN7lEEJpXcSsOrJy0_9ifzgcJvCJTE9C1hW-ig"

response


HTTP/1.1 200 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

{
    "content": [... ],
    "page": 0,
    "pageSize": 20,
    "total": 5
}

Logout

http :8080/logout Authorization:"Bearer eyJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MzMxOTgxNTYsInN1YiI6InVzZXIifQ.zvw99k1_Nh1UTNI6ZCBHL3v6-boXvuiyBNEcFM2LVhW0Rc6pAN7lEEJpXcSsOrJy0_9ifzgcJvCJTE9C1hW-ig"