-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support custom endpoints and configuration to the react-styleguidist server #273
Conversation
super(props); | ||
|
||
this.state = { response: 'No Server Response' }; | ||
this.handleInvokeEndpoint = this.handleInvokeEndpoint.bind(this, 'custom'); |
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.
Looks like you don’t use this second parameter (custom).
return webpackConfig; | ||
}, | ||
|
||
configServer(app) { |
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 it should be configureServer
.
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.
Great! I like configureServer
@@ -44,5 +45,16 @@ module.exports = function(config) { | |||
makeWebpackConfig(env) { | |||
return makeWebpackConfig(config, env || 'production'); | |||
}, | |||
|
|||
/** | |||
* Return an info object containing the created server instance and the instanced webapck |
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.
webapck
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.
Do we need this in the public API? What’s the use case?
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.
As discussed on gitter I'll remove it from the public API
Cool, thanks! |
Updated tests to reflect changes made on the API.
As discussed on gitter this PR enables styleguidist users to add new endpoints to the underlying express server.
A new field it's been added to
react-styleguidist
config module:configServer
.The registered function receive a pointer to the instanced
express
server and can add to it new endpoints, configure plugins and middlewares.This addition is vital for projects requiring access to server-side/filesytem features like the integration with
jest
snapshot testing (snapguidist) @MicheleBertoli and I are working on.Let me know if you feel the result is not what we discussed or if you would like some change.