sails-mongo

Handling database environment configuration in Sails.js

血红的双手。 提交于 2019-11-29 09:39:04
问题 The issue I have is related to the following quote from the official documentation: Note If any connection to an adapter is used by a model, then all connections to that adapter will be loaded on sails.lift, whether or not models are actually using them. In the example above, if a model was configured to use the localMysql connection, then both localMysql and remoteMysql would attempt to connect at run time. It is therefore good practice to split your connection configurations up by

Using Waterline model outside SailsJS api

谁都会走 提交于 2019-11-29 03:42:25
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

Using Waterline model outside SailsJS api

倖福魔咒の 提交于 2019-11-27 17:43:50
问题 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. 回答1: