Is it possible to use models defined within [app-name]/api/models
outside api
folder?
I have created separate folder in application root, where I placed cron job that should fill my database every hour. I would like to reuse Models defined inside my api
folder, but not sure how to do it.
I see that I can do sails.lift
inside that cron script but that doesn't seem very nice to me.
Did someone experience something similar? I'm new to node.js, so maybe I'm missing something pretty obvious.
If your concern with using
sails.lift
is that it starts an actual HTTP server that listens for requests, you can usesails.load
instead. It will do everything thatlift
does--including loading hooks and models--except for starting the server.