How I use Node.js professionally

It slices! It dices! But wait! There is more!

Shawn Grover
Oct 30 · 4 min read
Image for post
Image for post
Photo by Caspar Camille Rubin on Unsplash

Use the right tool for the job. But it is awesome when we find a tool that can be used effectively in many different ways.

I use Node to develop solutions for my customers. Those solutions may just be an API, or integrating with a front end framework over a REST interface. But those solutions sometimes involve setting up WebSocket servers, command line scripts, one-off data manipulation tasks, creating or accessing job queues, or even a comprehensive package that does everything in a modular way.

Here is how I break down my tasks

  • Data Access. I use Knex.js for creating my data models when I am dealing with relational databases. For non-relational databases I’ll use the appropriate library. Either way I wrap the access to the data store into meaningful data objects that can be used independently from the application. This allows me to call my data items from batch files, or other applications with little effort.

For one-off scripts I just call these with node path/to/my_script.js. For the recurring tasks though I add a script property to the package.json file so I can execute the commands with npm run mytask type statements.

Do you use Node.JS in a different way? If so, leave a comment and let me know. It would be great to hear of other approaches I can explore.

JavaScript In Plain English

New JavaScript + Web Development articles every day.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store