-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable storybook to deliver statics from hapijs server (#4)
- Loading branch information
1 parent
d831a25
commit a00ea24
Showing
6 changed files
with
1,746 additions
and
1,661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
# Storybook | ||
|
||
The boilerplate comes along with a fully functional storybook to present components | ||
The boilerplate comes along with a [storybook][1] to present components | ||
in an isolated (and mocked) environment to other developers and your clients. | ||
|
||
## Start Storybook | ||
|
||
Running storybook not only requires to exectute `npm run storybook` but also | ||
`npm run start:server`. If you want to enter the watch mode of the | ||
server run `npm run watch:server` as well. We recommend to run storybook | ||
together with the server in watch mode. | ||
|
||
## Static files | ||
|
||
The storybook is able to deliver static files, because we implemented a solution | ||
in [middleware.js](./middleware.js). The solution is based on [indiesquidge's | ||
solution](https://github.com/storybooks/storybook/issues/208#issuecomment-306953718). | ||
|
||
## Available features and toolset | ||
|
||
* [Apollo Client and GQL Endpoint Mocking](./gql/README.md) | ||
* [Mocked Redux Store](./redux/README.md) | ||
|
||
[1]: https://github.com/storybooks/storybook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Inspired by (Credits): | ||
* - https://github.com/storybooks/storybook/issues/208#issuecomment-306953718 | ||
* | ||
* Other links | ||
* - https://github.com/storybooks/storybook/issues/1685#issuecomment-336811882 | ||
* - https://github.com/storybooks/storybook/issues/714#issuecomment-302996551 | ||
* - https://github.com/storybooks/storybook/pull/435#issuecomment-264813688 | ||
*/ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const proxy = require('http-proxy-middleware') | ||
|
||
require('dotenv').config() | ||
|
||
const host = process.env.HOST || 'localhost' | ||
const port = process.env.PORT || 8000 | ||
|
||
// proxy static request to our Node.js server | ||
module.exports = function expressMiddleware(router) { | ||
router.use( | ||
'/__static__', | ||
proxy({ | ||
changeOrigin: true, | ||
target: `http://${host}:${port}/`, | ||
}), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.