We are going to be coding a fullstack application (frontend + backend) that will let the user upload a file and let us visualize relevant file metadata such as file type or size.
We’ll be serving both the front-end assets and API on the same Express based Node.js server, with some ECMAScript 2015 flavour added to it with Babel.
The client application code is up to you. I’m going to go bare-minimum here, but feel free to use a front-end framework if you want to go all out.
Finally, we’ll deploy the application to Heroku. If you want a quick guide to deploying to Heroku, take a look at this post.
Today, we are going to be building an image search abstraction layer that is built on top of the Bing search API. For this purpose, we’ll make use of Node.js + Express and Mongoose as an object manager for MongoDB. Additionally, we’ll harness the power of ECMAScript 6 using Babel.
URL shorteners are very useful. Remembering long and tedious URL addresses, or sharing 100 character URLs with your peers is not what we would call, convenient. That’s why we have services such as the Google URL Shortener, Bitly or TinyURL.
We are going to replicate the functionality that these pages offer to some extent. We’ll start off by creating an API using Node.js and the Express framework, and will integrate with a MongoDB instance to store information making use of Mongoose.
The functionality is quite straightforward, we must implement two endpoints in our application:
- /new/URL_TO_SHORTEN: Creates a new short URL for the provided long URL.
- /SHORT_URL: Will redirect to the long version of the provided short URL.
Instead of babbling around, let’s set up the project and install all of our dependencies.
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."