Closed kojilab closed 11 years ago
In node, require is a function not a statement (like ruby?)
You SHOULD assign the return value of require('geoip') to a javascript variable, like this:
var geoip = require('geoip');
This should solve your problem.
Thanks. IT works now. I know JS very well but I guess my brain is so backend oriented I missed that one
Yeah, that's one of the primary reasons why people loves node, : )
Yes. Tired of switching languages.
It works great by the way.
Thanks for the great library.
You are welcome to this community.
Can I use it with rails?
@sanvuthy
this is only for nodejs.
Hi,
I'm a nodejs newbie and I'm playing with railwayjs with GeoIP.
I've done
sudo npm install geoip
Then in my controller, I've got
require('geoip'); // this doesn't return any error as a module that is not found
then
var City = geoip.City; var citydata = new City('../../data/geo/GeoLiteCity.dat');
And I'm getting the error in the title.
Thanks for helping a newbie like me.