Read More
Mongoose Featured Image

Mongoose: Get started with MongoDB object mapping

Mongoose is a Node.js library that provides MongoDB object mapping features. To put it simple, it creates extensible JavaScript Object representations of the documents stored in a MongoDB instance.

It sounds a tidy bit more complicated that what it actually is, let’s get started with a few examples straight away. If you are familiar with the MongoDB in Node.js, you probably know that managing documents can become a bit cumbersome.

Read More
Create a Request Header Parser Microservice with Node.js

Create a Request Header Parser Microservice in Node.js

This time, we are going to be creating a request header parser microservice in Node.js. Keep in mind that I’ll be using a set-up similar to  that used by the previous two tutorials; for those who have not read them, that means that we’ll be using Express, and code our app using ECMAScript 6 thanks to Babel.

Feel free to go though the creation of a simple Express app post, as well as the set-up for using ECMAScript 6 within your node app.

Read More
ECMAScript 6 in Node.js with Babel

Use ECMAScript 6 in Node.js with Babel

ECMAScript 6 is a great step for JavaScript. It provides some invaluable tools that make developing new code a bliss. If you want to learn about the features that ECMAScript 6 (also known as ECMAScript 2015, ES6 or ES2015), take a look at this two part series:

Unfortunately, Node.js will not let you use ES6 features out of the box. It does provide a way of using some of the ECMAScript 6 features, but not the whole thing. That’s what we are here to fix.

Read More
Create a Timestamp Microservice with Node.js

Create a Timestamp microservice with Node.js

This time around, we are going to be coding our own timestamp microservice using Node.js, and then, deploy it to Heroku. It’s going to be a very simple service that will return the unix time and natural date for the received input. Our API should be able to receive and properly handle the following two formats:

  • A unix timestamp is a metric used to track time by displaying the miliseconds (sometimes seconds) that have passed since January 1st, 1970 at 00:00:00 UTC. For a quick test, you can get the unix timestamp for right now, by going into the Chrome DevTools console and typing the following: Date.now();
  • The natural language date means that the date is passed in the following format: October 1, 2016.

Our timestamp microservice will accept any one of these two formats, and then, return a JSON object containing both formats. In other words:

  • If the API receives this: 1477388794872, it will output the following JSON object:
    {
      "unix": 1477388794872,
      "natural": "October 25, 2016"
    }
  • Receiving “October 25, 2016” will output the same exact JSON object.

If no unix timestamp nor natural date is present, we’ll return null for both fields:

{
  "unix": null,
  "natural": null
}
Read More
JavaScript Resources

Ready to learn JavaScript? Here’s 3 books you want to read.

So you want to learn JavaScript. Know this, the path is dark and full of terrors (take that GoT reference as you’d like), but there are vast amounts of knowledge out there. The internet is the most powerful tool at your disposal, but, with great power comes great responsibility (what’s with the terrible references today anyway?), here’s why:

For every good and reliable source of information in the web, there’s 10 other sources that will do nothing but incur bad practices from the very beginning, and we don’t want that to happen, do we. I won’t teach you anything in this post today, but here’s a list of some of the best books, both free and non-free that you can look at and be confident about.

Know any other great books out there? Great! Post them in the comments section so we can all rejoice in knowledge! Here’s my top three: