Browserify support?
I'm trying to browserify sails-rest, which depends on restify, and my current issue stems from one of restify's dependencies, spdy:
Error: module "./spdy/protocol/generic.node" not found from "node_modules/sails-rest/node_modules/restify/node_modules/spdy/lib/spdy.js"
at notFound (node_modules/moonboots-express/node_modules/moonboots/node_modules/browserify/index.js:812:15)
As far as I can tell, spdy is only used by restify's server component (not its client), while sails-rest only uses restify's client.
As such, I figure the best way to proceed is to split off restify's client functionality into a standalone restify-client package, and use a custom version of sails-rest that uses restify-client instead of restify.
Is there any way around this labor-intensive approach? Is anyone already using restify on the browser?
for that you should supertest
Just to follow up, I tried removing createServer and the code that calls it, but even the client code can't be Browserified - the client relies on the mime module, which makes a dynamic fs.readFileSync call, which Browserify can't handle, even with the brfs transform.
Thanks for the suggestion. I'll find another way to do what I want to do.
@gergelyke I also met this issue. What do you mean we should supertest~? Does it mean that we should another library?
@StevenRoan yes, he meant we should use another library. sails-rest - even restify-client - is designed to run on the server only.
I wound up using https://github.com/visionmedia/superagent, which is the HTTP agent part of the supertest library he mentioned.
@airandfingers get it. Thanks for response