Added support for express 4.x

Express 4.x no longer uses a function to represent res.locals.  This is a fix for supporting 4.x and remains backwards compatible with 3 and 2.