https://github.com/jfrazx/status-codes
Collection of status code enums
https://github.com/jfrazx/status-codes
Last synced: 2 months ago
JSON representation
Collection of status code enums
- Host: GitHub
- URL: https://github.com/jfrazx/status-codes
- Owner: jfrazx
- License: mit
- Created: 2018-08-05T07:10:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-05T06:19:22.000Z (3 months ago)
- Last Synced: 2025-04-13T09:05:20.141Z (3 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.68 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Status Codes
[](https://www.npmjs.com/package/@status/codes)
[](LICENSE)A collection of status code enums.
## Available Enums
- Apache
- Auth0
- Braintree
- Cloudflare
- FirebaseAuth
- FTP
- Http
- IIS
- IRC
- Mocha
- MongoDB
- Mongoose \*wip
- Nginx
- Node
- Postgres## Install
npm:
`npm install @status/codes`yarn:
`yarn add @status/codes`## Example Usage
```typescript
import { Http } from '@status/codes';export class NotFoundError extends Error {
readonly code = Http.NotFound;
}
```Use with express:
```javascript
const { Http } = require('@status/codes');create(request, response) {
return Model.create(request.body)
.then(instance => response.status(Http.Created).json(instance))
.catch(error => response.status(Http.Conflict).json(error))
}
```