2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018

02/23/2014: Writing a nodejs script file

This is a short post about a simple topic but it's one that I hadn't thought about so sharing seems good. I like computer languages that run from back-end processing to front-end web site development. For example, Ruby handles the both environments, but Java doesn't. Today I realized that nodejs can also handle both. And it's simple. A nodejs script looks like this:

1. Create a file called helloWorld with the following contents:

#!/usr/bin/env node
console.log("Hello World.");

2. chmod +x helloWorld

3. ./helloWorld

Of course, you have the full power of javascript and nodejs to play with.

Have fun!


subscribe via RSS