Express.get app method to get app settings, and handle get requests.

The app.get method in express.js has two uses, one is for getting the value of a local app setting, and the other is to define what to do with http GET requests. So in other words it’s behavior is very different depending on the number of arguments that are given to it. If I just want to get the value of a certain app setting I only need to give the key of that setting to receive the corresponding key value. However if I want to do something with get requests I will want to not just give the path or pattern, but one or more functions that will do something with that incoming http get request. So this dual use of app.get works out okay, and as such I do not find it that confusing. So this will be a quick post on the ins and outs of app.get.

Read More

Using the express.js helmet.js middleware to set dns prefetch control headers

When making an express.js application security, and privacy should be of at least some concern. A good start with express might be to check out helmet.js. This express.js middleware is actually a collection of middleware modules that can be used to set some headers that may help to improve security, and privacy to some extent. It is not an end all solution of course, but it might be a good start to say the least. In this post I will be writing about one of the middleware methods that is used to set a header that will disable dns prefetching.

Read More

The app.use method in express.js

When making an express.js application one of the most important methods in the app object is the app use method. This method is important for making use of middleware modules, as well making your own middle ware methods. I will not be getting into middleware in depth here though but I have a post that is a good starting point for express middleware. There is also the app all method that does work in a similar way to that of app.use, but they are not the same thing.

Read More

The Express app object list of must know features

The app object in express.js is what is returned when calling the express top level function by itself, rather than one of the additional methods attached to it like express.static. The app object contains many useful methods for working with http requests, setting up a rendering engine like ejs, an using additional middle like express-session, and passport. This post will serve as an overview of that app object, and everything that is of great importance when developing an node.js powered web applaction with express.js as part of the stack.

Read More

Adding disqus comments to a hexo powered site

My very first blog post was on hexo tags, and now and then I still write another post on hexo for what it is worth. I do still use the node.js powered static site generator know as hexo for building my site here at github pages, so it makes sense to write another post now and then when I change something at the least. Becuae my site has recently surpassed ten thousand monthly visitors it seems like it would be a good idea to add comments to this site. In this post I will be writing about the process of adding disqus comments to a hexo powered site.

Read More