-
Notifications
You must be signed in to change notification settings - Fork 35
Conversation
) | ||
.demand(['f', 'p']) | ||
.describe('f', 'Path to the RAML definition') | ||
.describe('p', 'Port number to bind the proxy') | ||
.describe('cors', 'Enable CORS with the API') | ||
.describe('definition', 'URI of raml definition') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't required an extra parameter here. Instead, we should build the URL based on the API baseUri of the RAML file provided by -f
.
@@ -48,6 +48,14 @@ function createServerFromBaseUri (raml, options) { | |||
var app = osprey.Router() | |||
var path = (raml.baseUri || '').replace(/^(\w+:)?\/\/[^/]+/, '') || '/' | |||
|
|||
if (options.definition) { | |||
app.use('/resources', function (req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why /resources
? the way I read #33 is that it should work with all resources defined in the RAML definition.
@@ -48,6 +48,14 @@ function createServerFromBaseUri (raml, options) { | |||
var app = osprey.Router() | |||
var path = (raml.baseUri || '').replace(/^(\w+:)?\/\/[^/]+/, '') || '/' | |||
|
|||
if (options.definition) { | |||
app.use('/resources', function (req, res) { | |||
var body = '< link:"' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the <
is extraneous. It appears in the example of #33 because that's how curl
formats headers returned in responses.
Also, to be clear, this should be returned as a header
, not in the body
.
app.use('/resources', function (req, res) { | ||
var body = '< link:"' + | ||
options.definition + | ||
'" rel="describedby" type="application/raml+yaml">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The >
here is wrong too. This should follow the header Link
syntax as defined here.
No description provided.