middleware.js 496 B

1234567891011
  1. /* eslint-disable @typescript-eslint/no-var-requires, import/no-extraneous-dependencies */
  2. const middleware = require('storybook-django/src/middleware');
  3. // Target the Django server with IPV4 address explicitly to avoid DNS resolution of localhost to IPV6.
  4. const origin = process.env.TEST_ORIGIN ?? 'http://127.0.0.1:8000';
  5. module.exports = middleware.createDjangoAPIMiddleware({
  6. origin,
  7. // Must match the patterns in urls.py.
  8. apiPath: ['/pattern-library/', '/static/wagtailadmin/'],
  9. });