Skip to content

Commit

Permalink
docs: v2 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Oct 21, 2024
1 parent b962963 commit 13417aa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

Utility to interact with HTTP status codes.

## Migration to v2.x

Version 2 is a migration of the library to ESM modules and TypeScript. The API remains the same. The build system generates both ESM and CommonJS exports.

For ESM users, the import remains the same.

```js
import status from "http-status";
// Or
import { status } from "http-status";
```

For CommonJs users, update the `require` statement.

```js
const { status } = require("http-status");
// Or
const { default: status } = require("http-status");
```

## Usage

Once you import or require this module, you may call it with either an HTTP code or a status name. With an HTTP code, you will get the status name while with a status name you will get an HTTP code or some complementary information.
Expand Down

0 comments on commit 13417aa

Please sign in to comment.