Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default swagger-ui? #38

Closed
sinedied opened this issue Mar 9, 2017 · 3 comments
Closed

Use default swagger-ui? #38

sinedied opened this issue Mar 9, 2017 · 3 comments

Comments

@sinedied
Copy link
Contributor

sinedied commented Mar 9, 2017

It would be nice to also allow using the default index.html provided with swagger-ui instead of having to always provide our own, what do you think?

A property ui: true could be used, or a special value for the uiIndex property like `uiIndex: 'default'.

@daffl
Copy link
Member

daffl commented Mar 10, 2017

We could ship the default docs html (/~https://github.com/feathersjs/feathers-swagger/blob/master/example/simple/docs.html) and use that as the fallback if uiIndex: true (instead of the path).

Basically, copy the docs.html into the root level of this repo, then in /~https://github.com/feathersjs/feathers-swagger/blob/master/src/index.js#L45 change the condition to

if (typeof config.uiIndex === 'function') {
  config.uiIndex(req, res);
} else if (typeof config.uiIndex === 'string') {
  res.sendFile(config.uiIndex);
} else if(config.uiIndex === true) {
  res.sendFile(path.join(__dirname, '..', 'docs.html'));
} else {
  res.json(rootDoc);
}

@sinedied
Copy link
Contributor Author

That would be great!

@daffl
Copy link
Member

daffl commented Mar 12, 2017

Pull request welcome 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants