DailyJS

DailyJS

The JavaScript blog.


Taggoogle
Featured

libraries google python pyv8

Dreadnought, Data-Drive

Posted on .

Dreadnought

If there's a Python library that you really want to use with no equivalent in Node, what do you do? You could learn enough Python to get a Flask server running, but there's another option: run JavaScript from within Python!

Dreadnought-js (GitHub: dschere/dreadnought-js, License: MIT) by David Schere uses PyV8 to embed JavaScript into a Python web server. The author prefers thinking of JavaScript as an embedded language, as it's used with browsers, and has aimed to provide seamless support with Python and C libraries.

Dreadnought executes all HTTP requests within a separate child process launched by an internal web server allowing for synchronous programming using blocking calls without interfering with the main web service. This provides both fault tolerance and load balancing.

It naturally makes sense for Python programmers who want to use JavaScript, but I think it could also be useful for Node developers who want to use Python libraries for specific projects.

Data-Drive

Ramon Gebben sent in Data-Drive (GitHub: RamonGebben/data-drive, License: MIT), a library for reading and writing Google Spreadsheets.

Although there are other libraries that let you sign in to Google Spreadsheets and fetch data, Data-Drive has a feature that lets you map sheets. You can create JSON descriptions of fields and values that will be used to convert the data when it's downloaded from the API.

Given something like this:

"mapping": {
  "columns":[
    ["1", "key"],
    ["2", "key1"],
    ["3", "key2"]
  ]
}

You'll get:

{
  "key": "pizza",
  "key1": "koffie",
  "key2": "kebeb",
  "id": 1
}

Which is way more convenient!

Featured

frameworks libraries google node modules

Node Roundup: Taunus, Root Path, Mongorito

Posted on .

Taunus

Taunus

Taunus (GitHub: taunus/taunus, License: MIT, npm: taunus) by Nicolas Bevacqua is an MVC framework that offers full-stack progressive enhancement. It uses server-side rendering, and will also use the browser's history API for routing if it's available.

Taunus can deal with view caching on your behalf, if you so desire, using asynchronous embedded database stores on the client-side. Turns out, there's pretty good browser support for IndexedDB. Of course, IndexedDB will only be used if it's available, and if it's not then views won't be cached in the client-side besides an in-memory store. The site won't simply roll over and die, though.

It supports both Hapi and Express, so there's some flexibility on the server. The server-side component is mainly dedicated to rendering.

There's a getting started guide that shows how to set up a Taunus project and how to do basic things like adding a layout.

Root Path

Chris Morrell wrote a detailed response to a StackOverflow question about finding the root path for a Node project.

This resulted in the App Root Path Module (GitHub: inxilpro/node-app-root-path, License: MIT, npm: app-root-path), a small module that returns the path to the current module's main directory. It returns a string, so you just have to do require('app-root-path') and pass the output to require.

Chris notes that the basic method for this is: path.resolve(__dirname).split('/node_modules')[0];, but there are edge cases where require.main.filename is used instead. This is all explained in the StackOverflow post.

Mongorito for ES6

If you're using an ES6-based HTTP framework like Koa, then you might feel your database library could do with generator support as well. Fortunately, Vadim Demedes has rewritten his MongoDB module, Mongorito (GitHub: vdemedes/mongorito, License: MIT, npm: mongorito) to use ES6 generators.

Now you can load items like this:

var posts = yield Post.find();  

Saving works the same way:

yield post.save(); // document created

var id = post.get('_id'); // _id automatically had been set after .save()  

It's based on the monk MongoDB module, and has good test coverage. I've never used a module like this in production, but I definitely like the idea of generator syntax for databases.

Featured

frameworks libraries google node modules

Node Roundup: Eskimo, Serve-Me, Google BigQuery and Cloud Pub/Sub

Posted on .

Eskimo

Eskimo

Eskimo (GitHub: niftylettuce/eskimo, License: MIT, npm: eskimo) by niftylettuce is a framework for Node web applications. It has a command-line tool that is used to manage projects, known as igloos. You can add new models, views, and controllers, or create all three with mvc.

Once you've installed Eskimo with npm, you can generate a new app with eskimo create projectname. Projects use Express, the electrolyte dependency injection module, Redis, and MongoDB. You'll need to run npm install from the freshly created project to get the dependencies required for running the tests.

The authors have put sensible commands in package.json for npm start and npm test, so it works like most Node web applications. It also has a Vagrant file, so you should be able to test out deploying your applications without too much hassle.

Initially the documentation made me think it was an alternative to Yeoman, but it's actually an MVC web framework based on Express. The documentation and examples currently need expanding, but I found some cool tutorials on niftylettuce's blog.

Serve-Me

Serve-Me (GitHub: muit/serveMe, License: MIT, npm: serve-me) by Muitxer is a small web framework that's a bit like a mix of a static server and Sinatra. You can quickly configure it serve static pages, then add server-side route handlers with ServeMe.Routes.add('name', fn). The function has to return a string, which is why it's more like Sinatra than Express.

The reason I liked Serve-Me is it has no dependencies -- the author has used Node's core modules for everything. The source is quite short, so you might find it interesting if you're learning Node's core modules.

Google Cloud Platform Updates

Google's Cloud Platform Node module now has support for BigQuery and Cloud Pub/Sub. I read about this on Jonathan Beri's Google+ account:

gcloud-node, the Google Cloud Client Library for Node.js, has added support for BigQuery and Cloud Pub/Sub. These Cloud APIs join Cloud Datastore and Cloud Storage. Grab it with 'npm install --save gcloud' or check out the source on GitHub.

The module is available at GoogleCloudPlatform/gcloud-node on GitHub. There's a full TodoMVC example that demonstrates some of the module's features.

Featured

libraries google modules

Google's Cloud Platform Library

Posted on .

JJ Geewax announced the gcloud node (GitHub: GoogleCloudPlatform / gcloud-node, License: Apache 2.0, npm: gcloud) client library for Node. It allows you to access things like the Google Cloud Datastore database and Cloud Storage. You should be able to use it with Google Compute Engine or a Google Developer's service account.

I had a look at this module and there are a few interesting things to note:

  • They use Mocha for tests, and there are lots of tests
  • The API and code formatting are in line with the Node community
  • The documentation looks modern and uses AngularJS (it's generated with dox)

There's a blog post about the project here: gcloud-node - a Google Cloud Platform Client Library for Node.js which demonstrates the API.

With a little bit of configuration, getting data from the API is as simple as dataset.get:

dataset.get(dataset.key(['Product', 'Computer']), function(err, entity) {  
  console.log(err || entity);
});

With cool Node libraries like this, AngularJS, and MEAN on Google Compute Engine, I'm just waiting for someone at Google to bring a first-party Node IDE to my Chromebook!

Featured

google services node

Google Get MEAN

Posted on .

Google MEAN

Melissa from Linnovate, the company behind MEAN.IO, wrote in to say Google have announced support for MEAN on Google Compute Engine.

Normally when I think of Google I think Java and Python. Other services including Heroku and Azure support a wide range of platforms, including Node, so it's exciting to see Google offering MEAN.

The developer guide is here: MEAN development stack on Google Compute Engine, but it's worth noting that the MEAN stack can be brought up with click-to-deploy. That means you can get MongoDB, Express, and Angular running in minutes, using a web-based wizard.

I'm not exactly sure how the pricing works with MongoDB, because SQL database pricing is different from Compute Engine. I created a click-to-deploy MEAN project and it seemed to show all the resources under Compute Engine, so I think that means all prices are based on CPU/disk usage.

I make a lot of Express apps, and Google's developer tools (including the web console) seem compelling even next to Heroku and Azure, so I'd definitely like to try this for a real project soon!