-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
requires/mongodb models w/ zappa? #85
Comments
You're a brave man! :) Sorry, Until 0.3.0 is released, you can use this if you're having problems: require('zappa') {require}, ->
HechoProvider = require('hechoprovider-mongodb').HechoProvider Which is just a way to pass the real require to the zappa block, equivalent to the javascript: require('zappa')({require: require}, function(){
var HechoProvider = require('hechoprovider-mongodb').HechoProvider;
}); As a side note, the following CoffeeScript lines are equivalent: HechoProvider = require('hechoprovider-mongodb').HechoProvider
{HechoProvider} = require 'hechoprovider-mongodb' |
Thanks for the amazingly quick response and the pointers...and the bit of mindbending coffeescript lesson at the end. I added that line to the top of the app file, and while it is including just dandy now, it is still not finding the mongodb module, though the module is found in the basic Express app. I'm definitely getting the sense that I may be a bit out of my depth here...but I'm game to keep on going. Any other ideas? |
Is the express app in the exact same dir as the zappa one? Also, in the same file where the zappa app is, if you take zappa out of the equation, does it work? Ex.: console.log require('hechoprovider-mongodb').HechoProvider |
Doh. Just learned where npm modules are installed in Express projects. Thanks. Ethan
|
Hey there,
Thanks for Zappa. As a node/express/coffeescript n00b I should probably know better than to just jump right in to such an abstracted development system...but it's just too much fun!
That said, I'm having issues with requires in Zappa, specifically trying to require a provider using mongodb. I'm basing my code on the blog example from the Blog rolling tutorial on howtonode. I figured out that the require needs to be within the zappa require, like so:
When I run the app, however, I get the following error:
Where the provider-mongodb.js file starts with
Is there a better way to use mongodb providers with Zappa? Is there something I should be doing to get the above code working?
Thanks,
Ethan
The text was updated successfully, but these errors were encountered: