Closed bonanzakrak closed 8 years ago
@bonanzakrak for sure, could you give me more explaination? could you post the full error log or write a simple test ?
I have the same problem but I don't have any error message.
{
"hooks": {
"orm": false,
"pubsub": false
}
}
module.exports.blueprints = {
...
prefix: '/v1'
...
};
/v1/myModel/1 -> 404
Same @pdavid0 said. When you thy to execute any blueprint method from method they are not present. All models are ignored by router. Its easy to check.
With Waterline:
first lines from model/controller User log: silly: Binding RESTful blueprint/shadow routes for model+controller: user silly: Binding route :: get /user (POLICY: texts)
With Offshore: there is no RESTful, only controller actions. All actions that should be available from model like GET, POST return 404.
first lines from model/controller User log: silly: Binding action (myAction) blueprint/shadow route for controller: user silly: Binding route :: /user/myAction/:id? (POLICY: texts)
It may be something with router, that is ignoring Offshore ORM. But would be nice to find a solution how to fix it.
Will try to find a moment and create a project that will illustrate the issue with tests.
@bonanzakrak i'll take a look too but i would love add travis test
I think i found the issue. Its inside Blueprint hook itself. Its checking if ORM hook is enabled. Because Offshore hook is disabling Waterline it will not work that way. Here is mine solution written in 15 minutes not well tested yet: sails-hook-blueprints-offshore
@bonanzakrak great work ! what did you changed and how do you think it could be integrate in this hook?
@atiertant i changed hook name
sails.hooks.orm
to
sails.hooks['orm-offshore']
and event listener
eventsToWaitFor.push('hook:orm:loaded');
to
eventsToWaitFor.push('hook:orm-offshore:loaded');
also added
var offshore = require('offshore');
@bonanzakrak thanks for your help, the problem with this solution is to maintain code...but the benefit is that we could integrate deep in blueprints...
@bonanzakrak i don't think var offshore = require('offshore');
is required, so package.json needn't offshore as dependency
@atiertant i removed that dependency. I don't know why it crashed without it before. Now it works without it.
the hook sails-hook-blueprints-offshore is now packaged in npm. thanks @bonanzakrak
I just tested that and have noticed that Blueprint API is not working with this hook. Is there any possibility to make it work ?