Skip to content

Commit

Permalink
fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarchie committed Oct 10, 2023
1 parent 558129c commit 45483b8
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ This library supports several different routing primitives:
- `MethodRouter` supports loading routes based on HTTP verbs (GET, POST, etc.).
It does not make assumptions where the request meta-data comes from, so has to
be called explicitly.

```javascript
import { MethodRouter } from "some-router";

const router = new MethodRouter();
router.get("/", function () {
return ("/");
});
router.get("/a", function () {
return ("/a");
});

const { callback } = router.find("GET", "/");
console.assert(callback() == "/");
```

- `HTTPRouter` supports the functionality from `MethodRouter`. It loads
information of request path and HTTP verb from the HTTP request object.

Expand Down Expand Up @@ -57,21 +73,6 @@ This library supports several different routing primitives:
};
```

```javascript
import { MethodRouter } from "some-router";

const router = new MethodRouter();
router.get("/", function () {
return ("/");
});
router.get("/a", function () {
return ("/a");
});

const { callback } = router.find("GET", "/");
console.assert(callback() == "/");
```

### Route Types

- Static - This is an exact string match.
Expand Down

0 comments on commit 45483b8

Please sign in to comment.