SWD4TN023 - Bookstore assigment
Start new training project. This exercise will run trough course and will be updated periodically to Github
First week
- Create project called Bookstore using Spring Initializer (Add web, test dependencies)
- Add new controller named BookController, mapped at /index
- Add new model-class Book, has following attributes: title, author, year, isbn, price
- Add your project to Github from commandline
- Use suggested Spring Boot project hierarchy
First release: https://github.com/aryokkynen/bookstore/archive/0.01-alpha.zip
Second week
- Bookstore: Add JPA and database
-Add JPA support and H2 database to your bookstore project (in GitHub) by modifying pom.xml file - Create an entity from your Book class
- Add command line runner to insert few example data to your database
- Modify properties to show sql statements
- Create a template called booklist.html which shows all books from the database in html table.
-To show the books you have to add new method to controller that handle GET request from endpoint like /booklist - Add Create and Delete functionalities to your Bookstore application
-For create functionality add new thymeleaft emplate called addstudent.htmlUsed form on booklist page
-For deletion use @PathVariable annotation - A Little bit Front-end (Extra)
-Add Bootstrap to your bookstore application. Download bootstrap.min.css from the bootstrapsite.
-Copy it to your projects resources\static\css folder.
-Add link to your booklist template file.
Second release: https://github.com/aryokkynen/bookstore/archive/0.02-alpha.zip
Third week
Part 1 - Securing the web application
- Add Spring Security to your project by adding dependency
- Add Spring Security configuration class which will secure all URLs (requires authentication in all URLs) and add two in-memory users with roles USER and ADMIN
- Create the login page and add login method to controller
- Add logout functionality to your booklist page
- Show authenticated username in your booklist page
- Restrict Delete book functionality only to users with ADMIN role
Part 2 - Securing the web application Part II
- Create user entity for your application endusers
- Attributes: username (unique), password, email, role
- Create crud repository for user entity
- Implement UserDetailService
- Add some users to your database and hash the passwords with BCrypt hashing algorithm
- Change Spring Security configuration to use user entites instead of in-memory users in authentication
Part 3 - REST
- Create REST service that return all books (JSON)
1 . Create a method to controller
2 . Ignore one-to-many link from JSON - Create REST service that return one book by id (JSON)
1 . Create a method to controller
2 . Use path variable to get book id - Change REST api path to /api
1 . Modify your application.properties
Third release: https://github.com/aryokkynen/bookstore/archive/0.03-alpha.zip
Week 6&7
React front
- Add react.js to your Spring Boot project
- Print your bookstore database content in table form
- Add delete button which removes book from database
- Add form to create new book & refresh view once book is added
- Add authentication using Spring Security module
Fourth release: https://github.com/aryokkynen/bookstore/archive/0.04-alpha.zip