How to use the @kadira/storybook/dist/server/middleware.default function in @kadira/storybook

To help you get started, we’ve selected a few @kadira/storybook examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / @sanity / storybook / server / index.js View on Github external
module.exports = config => {
  const app = express()
  const host = config.host || 'localhost'
  const port = config.port || 9001

  if (config.staticPath) {
    app.use(express.static(config.staticPath, {index: false}))
  }

  const configDir = path.join(__dirname, 'storyConfig')
  app.use(middleware(configDir))

  return new Promise(
    (resolve, reject) => app.listen(port, host, err => {
      if (err) {
        reject(err)
      } else {
        resolve(`http://${host}:${port}/`)
      }
    }
  ))
}