DISCLAIMER: This repository is an exercise to practice working with legacy code. Do not take it as a real project. It is not a real project.
This is the Brownfield library Monolith repository. It runs the library portal for both members and curators.
Before starting:
- Install the git hooks using the
setup.shBash script - Make sure you are using Java 17 and that you have Maven installed
- To create a feature or when working in a User Story, use the User Story (or Task) code as a branch name (e.g
BL-16). - Each new commit must start with the prefix
[BL-N], whereNis the story or task number. You can exceptionally use the[fix]prefix for short-lived branches and quick fixes.
- Every time you create a new Pull Request, make sure you add the repo administrators to the PR review + 1 person from a different team.
To compile and run the application, do
It will show the application running at localhost:8080
-
If you run
npm run devfrom theweb-clientdirectory, it will automatically start runningjson-serverat port 9001 and the react client at port 5173. -
json-server configuration: You will have to keep the files in
web-client/json-serverup to date if you want the web-client to work in standalone mode.
- We use
testing libraryandmswto test components and the application. Usenpm testto run the tests. - Make sure you keep the test server up to date when adding new tests.
The database schema is updated by using Flyway migrations. Everytime you need to update the schema, make sure you add and test the adecquate migration scripts.
Run the tests with Maven by doing mvn test.
Use the -P flag to control the application profiles: test, dev and prod
mvn -P{profile} spring-boot:run
- The
prodprofile connects the application to a Postgres database, whereas thedevandtestprofiles use H2. - The
devprofile loads initial data using sample.sqlstatements placed in theresourcesfolder.
If you want to use docker instead of manually configuring a Posgres database:
docker run --name postgres-container -e POSTGRES_USER=leguin_admin -e POSTGRES_PASSWORD=leguin_forever -e POSTGRES_DB=library_db -p 5432:5432 -d postgres