This code is another demo of how Spring Data REST can massively simplify code.
The original project had a simple domain object. Then it created a customer Spring MVC controller to create RESTful CRUD ops. Backing the controller was a service layer that used raw JDBC code to perform various CRUD ops to a persistent data store.
Issues:
I basically threw out the controller, the DAO, and the connection creation library. I edited the domain POJO so that field names matched the getters/setters. (Spring Data couldn't
handle such a deviation). No more need for a connection creation library. I then created a TaskRepository
interface and added a few custom finders. From there, I was able to
focus all my effort on fixing the Angular front end to talk to the right endpoints. Even though I didn't know a thing about Angular, I was able to fix things up and get the
app working again.
I create a maven build file, so it's quick and easy to run.
== To run in "dev" mode
This runs things in a local "dev" mode by using the in-memory H2 database.
From the command-line:
Or from your IDE, run Application.main
.
From there, navigate to http://localhost:8080/home.
== To run in "production" mode
NOTE: This runs things in a local "dev" mode by using the in-memory H2 database.
You can also build and run as an executable JAR file:
WARNING: -Dspring.profiles.active=production
does NOT work when running mvn spring-boot:run
.
New Issues:
taskArchived
to true, I use a JavaScript forEach statement then re-fetch all the tasks. It would be
best to wait until ALL tasks are updated to do that. https://github.com/cujojs/when[when.js] is great resource for this.