Working in Node.JS
Working in Node.JS
Lately I’ve been working in Node.JS building an API for our application. We are slowly breaking free from our Rails 4 application and switching our architecture to a client server architecture. I know Rails is fully capable of providing a JSON REST api but the existing application is in such poor shape that it would take years to re-write the application. I don’t think this was the developers fault but more of the lack of experience combined with a lousy architect.
Why pick Node?
The frameworks that we are using are Express.JS to handle the REST API. Express has been great to work with. One of the key advantages in using express is taking advantage of how it uses middleware. This lets us write our sevices at a more module level. The best advantage is since writing our API as modules, if we notice that our load is changing and we are getting lots of traffic, we can split that module out of the API. Create a new service with the same code and deploy that to as many servers as we need. This is kind of how we handle micro-services. We can easily scale only portions of our application without needing to scale the entire application like what we would have to do with our Rails Application.
The next step for us is going to be extending out our API to other platforms. We have grand dreams of building that app that goes on your watch, what would it look like if we built notifications and put them on your refrigerator? Maybe we will continue to use JS to build an Electron Desktop application, a JS version for the Pebble smart watch.
Having an architecture that gives us that freedom is what is going to let us become successful. We take something very complex and make it accessible for everyone to use.
I’m going to be focusing on showing how to build API’s using Node.JS with different technologies. This is meant for more backend developers. I’ve started taking a liking to this area and I think I’m going to run with it. I’ll try and focus on some basic applications in the future.