Tag: express.js

Handlebars is a popular templating engine for JavaScript and in this post we’ll have a look at how to write a custom helper. On top of that, we’ll also look at pre-compiling a part of the template and returning the compiled HTML from the helper.

We’ll be using a simple express app with some handlebars views for the setup and we’ll just quickly walk through using handlebars with Express.

This post is going to be about creating an authentication with JSON Web Tokens for your project, presumably an API that’s going to be used by Angular, Vue.js or similar frontend frameworks. We’re going to send the jwt with every request, meaning that we don’t rely on sessions, but simply put the token on every request we make to the API. This way you don’t have to worry about cookies, but you can save it in localStorage or other places on the frontend.

In essence this tutorial will go through:

creating a /login route to acquire a token

creating a /secret route, that only is available to logged in users with a JSON web token

If you’re curious about the final result and don’t want the step by step guide, check out the final jwt express gist.

Express.js is one of the most popular node.js frameworks for serving websites or building APIs. This article is about how to enable Cross Origin Resource Sharing, also known as CORS. For that we need to set the correct headers in the response, which allow a browser to make use of the data from any domain.

Poet is a great little node.js based project that allows you to start a blog in no time.

TLDR; Put a bunch of MarkDown files in a folder and it’s available as a blog to the rest of the world. I just started a new project for JavaScript and I of course wanted to run it on JavaScript, even before GHOST was released, so I went with Poet.

I have a couple of ideas node.js would be great for. One of them is spam analysis. So I started importing around 14.000 spam comments from one of my blogs locally and am now setting up a little system that analysis things like which words occur the most in the comment field.