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]
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:
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.