when using path-to-regexp, how to match all path that not starting with /api/
?
By using native JavaScript RegExp /^(?!\/api\/).*/
will match/x/y/z
. see test result from here
However, it does not work with path-to-regexp. see the test result from there
So what's the correct way to achieve my goal in path-to-regexp?
[Update 1]
More details: The real case is that I'm using angular2 + koajs. And in angular2, browser may issue a client routing url to server. Please see my another question about this.
To address that issue, as suggested by @mxii, I'm trying to use koa-repath to redirect all requests that not started with /api/
to the root url: http://localhost:3000/
excepte it's static assets (js/json/html/png/...) requests.
And koa-repath
use path-to-regexp
to match the path. That's why I asked this question.