Posted in General

Spring Boot App Default Web Route Issue

By default Spring Boot is an opinionated wrapper around the Spring Framework. Many things are managed for you such as HTTP port, web context root, web server implementation, etc.

If you are using a view templating framework such as Thymeleaf, you might overlook adding it to your pom.xml file such that Maven resolves all transitive dependencies for you. If you forget, you may see the following error:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Oct 20 10:44:19 EDT 2016

There was an unexpected error (type=Internal Server Error, status=500).

Path home does not start with a "/" character
To fix this, add the thymeleaf dependency to your pom file:
Posted in General

Mongoose and momentjs

A seemingly simple issue came up with a side project of mine. Date queries can be quite a nuisance when passing this information from a datepicker in a view, to an Angular controller, through an express route and finally to some query that grabs the data and returns it back in a promise.

There are several stackoverflow posts like this one that hint at formatting your date prior to querying for the data on the backend. In my case, I used Mongoose.

Here is what I ended up doing when I wanted to specify a “date string” in the format “MM/DD/YYYY” to the backend. The express API looked something like this:

Where this is a query to retrieve all billing records for a particular user on a specific day.

The Mongoose call within the express middleware went something like this:

exports.getBillingLogsByUserAndDate = function(req, res) {
   var startOfDay = moment(req.params.serviceDate, 'MM/DD/YYYY')
   nextDay = moment(startOfDay, 'MM/DD/YYYY').add(1,'days')

   console.log('startOfDay: ' + startOfDay);
   console.log('nextDay: ' + nextDay);
      _userId: new ObjectId(,
      serviceDate: {
         $gte: startOfDay,
         $lt: nextDay
   }).exec(function(err, billingLogs) {

ObjectId is just the value passed into



The console.log statements will output something like the following:

startOfDay: 02/20/2016
 nextDay: 02/21/2016