This project contains a REST API Spring backend and an initial client side React application located in src.main/resources/static/js
. While not ideal to embed the React client in the Spring application it helps for Heroku deployments. Heroku can deploy Spring applications by looking for all front end resources in the src.main/resources/static/
...In a real environment, the client and server are both set up in different repositories and have separate deployments, but this setup shortcuts that process for demo purposes.
localhost:8080/api/books
will access the collection of bookslocalhost:8080/api/books/{id}
will access a singular book by plugging in a numerical value for idlocalhost:8080/api/books/{id}/add-hashtag
will provide aPOST
request to add a hashtag to a booklocalhost:8080/api/campuses
will access the collection of campuseslocalhost:8080/api/campuses/{campuseId}
will access a singular campus by plugging in a numerical value for campusIdlocalhost:8080/api/hashtags
will access the collection of hashtagslocalhost:8080/api/add-hashtag
will provide aPOST
request to add a hashtag to the database, NOT attaching it to a booklocalhost:8080/api/hashtags/{id}/delete-hashtag
will provide aDELETE
request to remove a hashtag
- Initial data is seeded through
Populator.java
- This application runs an in memory H2 database, therefore any interactions with the database happen locally and any
POST
,DELETE
requests will be reset if the Spring server is shut down and restarted - One regret is the inconsistencies in
hashtag
versushashTag
in several references throughout the application please be careful of how the backend is referencing this variable when interacting in the front end
The following dependencies have been installed in the React application
axios
to handle promises, asynchronous calls, any CRUD operations on the APIreact-css-modules
to provide unique style sheets for each component (does not matter if classes have same names in other files there will be no conflicts...this is great in a team setting so that members can work on features and not worry about their css selectors interfering with other parts of the application)react-router-dom
handles the front end routing architecture and custom url's that the client will requestjest
comes prepackaged in React applications as its testing suiteeslint-plugin-react
will provide warnings on code practices that could hang up deployments ... for example any references to unused variables in the front end will not allow for the application to deploy properly...Es Lint will catch these issues and warn the developer.