question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Express style paths

See original GitHub issue

I think it would be very useful to be able to use express-like paths. It’s especially useful when mocking an api that needs to store some simple state.

e.g.

const example = nock('http://example.com')

let users = new Map()

example.put('/user/:id', (uri, body, params) => {
  users.set(params.id, body)

  return [201]
})

example.get('/user/:id', (uri, body, params) => {
  if (!users.has(params.id)) return [404]

  return [200, users.get(params.id)]
})

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
LinusUcommented, Dec 11, 2018

Would still love to see this ☺️ hopefully I can send a PR for this 👍

1reaction
kbakbacommented, Jan 10, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Routing - Express.js
Route paths, in combination with a request method, define the endpoints at which requests can be made. Route paths can be strings, string...
Read more >
Express Tutorial Part 4: Routes and controllers - MDN Web Docs
The route paths define the endpoints at which requests can be made. The examples we've seen so far have just been strings, and...
Read more >
node.js - Difficulty with absolute and relative paths in Express
I try and it work, just add "/" before the link, example: you are in localhost:8080/courses/ and your href is: href="style/style.css" you will ......
Read more >
Edit paths in Adobe Photoshop
To select a path component (including a shape in a shape layer), select the Path Selection tool , and click anywhere inside the...
Read more >
Debian -- Details of package node-path-to-regexp in sid
Turn an Express-style path string such as `/user/:name` into a regular expression. Node.js is an event-based server-side JavaScript engine.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found