Hope you don't mind my asking... but do you really need a parser for a config file. Couldn't it just be required as below:
config.js module.exports = { host: "localhost", port: 8000 } app.js var c = require('./config') console.log(c.host + c.port); On Sun, May 27, 2012 at 7:18 PM, Alan Hoffmeister <alanhoffmeis...@gmail.com > wrote: > @Anand, yep, but you can use `npm link mymodule` > > -- > Att, > Alan Hoffmeister > > > 2012/5/27 Anand George <mranandgeo...@gmail.com> > >> Coming back to your question >> >> npm install -g mymodule will not be available when you require it using >> >> mymodule = require('mymodule') >> >> See >> http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/ >> >> On Sun, May 27, 2012 at 5:14 PM, Alan Hoffmeister < >> alanhoffmeis...@gmail.com> wrote: >> >>> @mscdex that's it. >>> >>> I need this to parse config files, and now I can require() my parser >>> from everywhere without the need to send the app path :) >>> >>> -- >>> Att, >>> Alan Hoffmeister >>> >>> >>> >>> 2012/5/27 Anand George <mranandgeo...@gmail.com> >>> >>>> Ok. I get it now. And thanks for both solutions offered. Guess it's >>>> useful in cases like the socket.io implementation where you wish to >>>> link some client-side libraries in the path. >>>> >>>> >>>> On Sun, May 27, 2012 at 11:10 AM, mscdex <msc...@gmail.com> wrote: >>>> >>>>> On May 26, 11:33 pm, Anand George <mranandgeo...@gmail.com> wrote: >>>>> > Next run app.js and the console logs >>>>> > >>>>> > /home/anand/node/Testing/dirpath >>>>> >>>>> I think he wants the path of app.js from the module, so: '/home/anand/ >>>>> node/Testing/pathtest' is what he is expecting. >>>>> >>>>> -- >>>>> Job Board: http://jobs.nodejs.org/ >>>>> Posting guidelines: >>>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>>>> You received this message because you are subscribed to the Google >>>>> Groups "nodejs" group. >>>>> To post to this group, send email to nodejs@googlegroups.com >>>>> To unsubscribe from this group, send email to >>>>> nodejs+unsubscr...@googlegroups.com >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/nodejs?hl=en?hl=en >>>>> >>>> >>>> -- >>>> Job Board: http://jobs.nodejs.org/ >>>> Posting guidelines: >>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>>> You received this message because you are subscribed to the Google >>>> Groups "nodejs" group. >>>> To post to this group, send email to nodejs@googlegroups.com >>>> To unsubscribe from this group, send email to >>>> nodejs+unsubscr...@googlegroups.com >>>> For more options, visit this group at >>>> http://groups.google.com/group/nodejs?hl=en?hl=en >>>> >>> >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to nodejs@googlegroups.com >>> To unsubscribe from this group, send email to >>> nodejs+unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >>> >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en