v3.0.0
Documentation v3.0.0: https://raw.githack.com/jaywcjlove/mocker-api/3e4dce7/index.html
Comparing Changes: v2.10.0...v3.0.0
npm i mocker-api@
- 📖 doc: update document.
- 🐞 fix: resolve issues caused by path-to-regexp. (#335)
- 🆎 type: fix pathToRegexp type error. #335
- 💄 chore(deps): update dependency html-webpack-plugin to ~5.6.0 (#318)
- 🐞 fix(deps): update dependency path-to-regexp to v8 (#335)
- 🆎 type: fix watch option type error. #334
- 🐞 fix(deps): update dependency chokidar to v4 (#334)
After upgrading to path-to-regexp v8, changes were introduced to proxy and mock API routes. The new version enforces stricter syntax rules, eliminates ambiguous patterns, and reserves specific characters to improve clarity. Additionally, updates are required for optional, repeating, or escaped parameters.
- use parameters instead (.*)
*path
, support v3.0.0+
-'GET /api/:owner/:repo/raw/:ref/(.*)'
+'GET /api/:owner/:repo/raw/:ref/*path'
-'GET /api/:owner/:repo/raw/:ref/(.*)': (req, res) => {
+'GET /api/:owner/:repo/raw/:ref/*path': (req, res) => {
const { owner, repo, ref } = req.params;
// http://localhost:8081/api/admin/webpack-mock-api/raw/master/add/ddd.md
// owner => admin
// repo => webpack-mock-api
// ref => master
- // req.params[0] => add/ddd.md
+ // req.params.path => add/ddd.md
return res.json({
id: 1,
owner, repo, ref,
- path: req.params[0]
+ path: req.params.path
});
},