In the previous post, I explained my frustration about seeking possible close (geographically) and awesome future employers. I started my journey towards geo aware job finding application by discussing Node.JS basics.
In this post, I would like to serve some companies that offer positions in my field, from the node web server we just created. This means, we need to retrieve them from somewhere. Aha! A database? Well, this could be anything from hard coded JS array, a file and of course – a database. Following this short presentation about using LevelDB with Node.JS I decided to use LevelDB for this tutorial. This turned to be a bad decision. While my tests on Amazon EC2 cluster went very well, installing level on a Windows machine became a sisyphic task. Simply trying
> npm install level
Will fail. Looking at the logs you can see some rants about leveldown failed installation. LevelDB is composed from 2 main packages: levelup – which provide a high level API to the DB, and leveldown which provide the low level hard core DB functions. Trying to follow the instructions on Richard’s blog by installing only levelup:
> npm install levelup
will give a wrong first impression. While the installation goes by ok, the DB will fail on first try:
c:\Dev\node\geojob>node > var level = require('levelup'); undefined > var db = level('./DatabaseDirectory'); LevelUPError: Could not locate LevelDOWN, try <code>npm install leveldown</code> at getLevelDOWN (c:\Dev\node\geojob\node_modules\levelup\lib\util.js:109:11) at LevelUP.open (c:\Dev\node\geojob\node_modules\levelup\lib\levelup.js:109:37) at new LevelUP (c:\Dev\node\geojob\node_modules\levelup\lib\levelup.js:82:8) at LevelUP (c:\Dev\node\geojob\node_modules\levelup\lib\levelup.js:44:12) at repl:1:10 at REPLServer.self.eval (repl.js:110:21) at repl.js:249:20 at REPLServer.self.eval (repl.js:122:7) at Interface.<anonymous> (repl.js:239:12) at Interface.emit (events.js:95:17) >
Again, because of our friend leveldown. Trying to install leveldown directly will fail as well.