1.0.1 • Published 1 year ago

octopus-express v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

Welcome to octopus-express 👋

Version Documentation Maintenance Twitter: jsdotx3

Extend response for used method according HTTP Status Code.

🏠 Homepage

Install

npm install octopus-express --save

Usage

After install, in your app.js can added this middleware before all routes.

const octopus = require('octopus-express');
app.use(octopus());

Octupus Express has multiple utils for object response of Express, for example, previously you programmer this:

res.status(400).json({error: 'Message')}

Now, with Octupus Express, your code is beatiful and simple.

res.badRequest('Message');

Example Methods

  • 200: res.ok('message')
  • 400: res.badRequest('message')
  • 401: res.unauthorized('message')

List Http Status Availables

HTTP StatusMethodFunction
100Continuecontinue
101Switching ProtocolsswitchingProtocols
102Processingprocessing
103Early HintsearlyHints
200OKok
201Createdcreated
202Acceptedaccepted
203Non-Authoritative InformationnonAuthoritativeInformation
204No ContentnoContent
205Reset ContentresetContent
206Partial ContentpartialContent
207Multi-StatusmultiStatus
208Already ReportedalreadyReported
226IM UsedimUsed
300Multiple ChoicesmultipleChoices
301Moved PermanentlymovedPermanently
302Foundfound
303See OtherseeOther
304Not ModifiednotModified
305Use ProxyuseProxy
307Temporary RedirecttemporaryRedirect
308Permanent RedirectpermanentRedirect
400Bad RequestbadRequest
401Unauthorizedunauthorized
402Payment RequiredpaymentRequired
403Forbiddenforbidden
404Not FoundnotFound
405Method Not AllowedmethodNotAllowed
406Not AcceptablenotAcceptable
407Proxy Authentication RequiredproxyAuthenticationRequired
408Request TimeoutrequestTimeout
409Conflictconflict
410Gonegone
411Length RequiredlengthRequired
412Precondition FailedpreconditionFailed
413Payload Too LargepayloadTooLarge
414URI Too LonguriTooLong
415Unsupported Media TypeunsupportedMediaType
416Range Not SatisfiablerangeNotSatisfiable
417Expectation FailedexpectationFailed
418I'm a TeapotiMATeapot
421Misdirected RequestmisdirectedRequest
422Unprocessable EntityunprocessableEntity
423Lockedlocked
424Failed DependencyfailedDependency
425Unordered CollectionunorderedCollection
426Upgrade RequiredupgradeRequired
428Precondition RequiredpreconditionRequired
429Too Many RequeststooManyRequests
431Request Header Fields Too LargerequestHeaderFieldsTooLarge
451Unavailable For Legal ReasonsunavailableForLegalReasons
500Internal Server ErrorinternalServerError
501Not ImplementednotImplemented
502Bad GatewaybadGateway
503Service UnavailableserviceUnavailable
504Gateway TimeoutgatewayTimeout
505HTTP Version Not SupportedhttpVersionNotSupported
506Variant Also NegotiatesvariantAlsoNegotiates
507Insufficient StorageinsufficientStorage
508Loop DetectedloopDetected
509Bandwidth Limit ExceededbandwidthLimitExceeded
510Not ExtendednotExtended
511Network Authentication RequirednetworkAuthenticationRequired

Author

👤 Jose Nuñez A. jos.nuneza@gmail.com

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Jose Nuñez A. <jos.nuneza@gmail.com>.

This project is MIT licensed.

1.0.1

1 year ago

1.0.0

4 years ago

0.2.1

4 years ago

0.2.0

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago