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!
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!