vercel / serve-handler

The foundation of `serve`

Home Page:https://npmjs.com/serve-handler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pass all static requests, but rewrite the api/html requests

ImHype opened this issue · comments

commented

I have some requests, just like:

/page-a
/page-b
/static/xxx/a.aaa.js
/static/xxx/b.bbb.js
  • page-a and page-b response public/index.html.
  • /static/xxx/a.aaa.js response public/static/xxx/a.aaa.js
  • /static/xxx/b.bbb.js response public/static/xxx/b.bbb.js

Negative lookahead is your friend

rewrites": [{
    "source": "/((?!api\/.*).*)",
    "destination": "/index.html"
  }]
commented

ok. i see