Meteor With Tedious From Npm

This post is meant as an update to my previous post regarding the access of an MSSQL database from your Meteor app. Version 0.6.0 of Meteor simplifies the inclusion of Npm modules, utilizing Meteors own package mechanism. You cannot directly include Npm modules in your app, though. You have to take the little detour of defining a private package. Well that sounds difficult. But it’s not. Here are the command line steps:

cd [YOUR METEOR APP FOLDER]
mkdir packages
cd packages
mkdir tedious
cd tedious
touch package.js
kate package.js

In your app directory create a folder with the name: “packages”, if it doesn’t exist already. Change into it and create a folder for the Npm module you like to include. I made a “tedious” folder. Again change into it and create a single file with the name: “package.js” there. Open the file with your favorite editor and define the package in the following way:

To actually use tedious in the rest of the app, you have to provide a way to access it. You can do this by adding a variable to the global scope. Unfortunately you have to do this in a separate file. Add a file:

touch load_tedious.js
kate load_tedious.js

And put the following content in it:

When you start your Meteor app, it will pull tedious and all of its dependencies from Npm. Now you can access tedious by simply using the variable name. For example this way:

Afterwards you can proceed as before and outlined in the post referred above.

Advertisements

7 thoughts on “Meteor With Tedious From Npm

  1. jasonratcliffe says:

    Hi Shiggy,

    It looks like the pictures of what you’re entering into package.js and load_tedious.js are missing – is there any chance you could fix this post please?

    Thanks,

    Jason

    1. Dirk Porsche says:

      Hi Jason,

      WordPress.com recently changed the way on how to include Github gists. And I haven’t caught up updating all posts. I did just that for the post you requested.

      Kind regards,
      Dirk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s