The world today is all about social and collaborative applications and having an easy deploy and built backend is way important. Lots of organizations today are relying on an app stack through a number of technologies such as MongoDB, Express and Node.js. It is a stack that has become a favourite for many, especially in mobile apps due to the fact that the native information format is essentially JSON and can be parsed easily by applications through comparable parsers In fact, a great yet simple app such as nodejs-url-shortener has been created through these vital technologies.
A popular module of Node.js, Express is very important in routing middleware. This separate package is vital for many reasons. For instance, if one ends up using “http” alone or by itself, the location’s request would have to be parsed separately towards figuring out the content that need to be served up to a caller, something that becomes impossible in just a short period. With Express on the other hand, routes can be easily defined including callback chains for every request. Through Express it is also easy for diverse callbacks to be provided as per a certain http verb such as HEAD, DELETE, and PUT or POST among others.
JSON objects are stored in a MongoDB database. It contrasts with SQL Database in that as one of the NoSQL databases, Mongo hardly supports relationships among entities. Also, a predefined schema is absent and entities with the same table or collection hardly require similar fields or conforming to a particular predefined pattern. At the same time, MongoDB comes with a strong querying language known as Map-reduce together with location data support. Due to its ability to shared, replicate and scale, MongoDB is very popular. Rather than storing JSON as it is, MongDB stores it in a BSON format (Binary JSON), which is highly efficient for queries and storage of data. BSON comes with more benefits in that it is able to support lots of datatypes more than what JSON does, for instance C-types and dates.
Checkout the MongoDB University free online courses on their website they are doing amazing job, I’ve learnt many things about NoSql & MongoDB during my online M101J course, its a great way to learn MongoDB.
- The source code of node url shortener on github @ https://github.com/minhajkk/nodejs-url-shortener
- This is my attempt to convert url-shortener using yoeman full stack generator https://github.com/minhajkk/full-stack-url-shortener
- The code is deployed on heroku @ https://node-us.herokuapp.com/ & http://mean-shortener.herokuapp.com/
- There’s a great article posted on heroku dev center on step by step deployment of nodejs application at heroku have a look @ https://devcenter.heroku.com/articles/getting-started-with-nodejs