GORT – The day the earth DID NOT stand still

If you are a Sci-fi fan then you are probably familiar with the lovable Gort from “The Day the Earth Stood Still.”  Well, this post has nothing to do with that Gort. Instead, it has to do with this Gort, a command line tool for RobotOps.

I have been trying to work with CylonJS and various pieces of hardware lately, and I ran across the GORT software on their Arduino page.  It seemed pretty cool, a simple download and unzip and you are ready to rock some device scanning from the command line.  I would say that this tool is pretty useful, and easy to use.  Here are a couple of things I have used it for, as well as a tip.

Install – you download their package and unzip.  Then you have this gort directory sitting wherever it was unzipped to.  I recommend, for Mac, that you copy that folder to /usr/local, then set up your .bashrc or .bash-profile to have a path to it, something like this:

export PATH=/usr/local/bin:/usr/local/gort_0.2.2_darwin_amd64:$PATH

Now you will be able to run the gort command anywhere in your system, which is useful.

The two main things I use it for are to scan for ports ( gort scan serial ) and to upload firmata to an Arduino without using the Aruino IDE.

That’s all I have for you on this topic, so go ahead and check out the site mentioned above and hang with Gort.

Static files returning 404 in Express 3

This is a TIP to help you past a common gotcha with Express 3 static files. This does not happen in Express 4

This is a quick tip for those of you experimenting with Node.js and the Express framework.  Express allows us to create all of these wonderful rest based endpoints to give us all this great data, but sometimes you need to serve static files too.  How else are you going to get you JS, CSS, etc files to the client?

Well many people do this setup or something similar:

app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(express.static(__dirname + '/public'));

Then they run their app and none of the static css, images, or JavaScript files are served up.  Everything 404′s on them.  What the heck is going on?

Well it’s the last two lines

app.use(express.static(__dirname + '/public'));

You see, everyone tells you about serving static files up with this:

app.use(express.static(__dirname + '/public'));

So you put in at the end, right after:


And that’s the problem.  You see app.use is called on app.router so now all requests will get caught by the app.router.  Everything is called in order in the app.use chain.

To fix this simply make sure you call app.use(app.router) AFTER your other app.use expressions.

app.use(express.static(__dirname + '/public'));

Thanks so much for reading this, now upgrade to Express 4 and forget all of this, as router is not used in the middleware anymore.