Comparing version 0.0.0 to 0.0.1
{ | ||
"name": "http-msgs", | ||
"version": "0.0.0", | ||
"description": "This contains node modules for http.responce.writeHeader values", | ||
"version": "0.0.1", | ||
"description": "Node module to handle to HTTP status codes", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# http-msgs | ||
Node module to handle to HTTP status codes | ||
![verson](https://img.shields.io/badge/version-0.0.7-green.svg) | ||
![verson](https://img.shields.io/badge/version-0.0.1-green.svg) | ||
![License](https://img.shields.io/badge/License-MIT-yellowgreen.svg) | ||
![under development](https://img.shields.io/badge/Under-Developement-red.svg) | ||
This module sets the the http messages for nodes http server | ||
it usess `request` and `responce` arguments of`http` | ||
`resEnd` argument is boolen by defulat it is set to true | ||
if set set to true it trigeers `res.end()`. if sets to false call function has explicitly call `res.end()` to end responce to client application. | ||
## httpMsgs | ||
req and res are request and responce objects | ||
## 200 and plus | ||
``` | ||
httpMsgs.sendJSON 1eq, res, data, resEnd) | ||
This send json object back after with success | ||
data = retun data is in JSON format | ||
``` | ||
``` | ||
httpMsg.send200(req, res, resEnd) | ||
This send only 200 status but not data returned | ||
``` | ||
## 300 plus | ||
``` | ||
httpMsgs.movedPermently = function(req, res, url, resEnd) | ||
moved permentantly | ||
``` | ||
``` | ||
httpMsgs.redirectTemporary = function(req, res, url, resEnd) | ||
Temporary redirect | ||
``` | ||
#### httpMsgs.sendJSON = function(req, res, data) | ||
This send json object back after with success | ||
data = retun data is in JSON format | ||
``` | ||
httpMsgs.redirectPerment = function(req, res, url, resEnd) | ||
perment redirect | ||
``` | ||
#### httpMsg.send200 = function(req, res) | ||
This send only 200 status but not data returned | ||
## 400 plus | ||
``` | ||
httpMsgs.send405(req, res, resEnd) | ||
Method not supporetd i.e request.methods supported | ||
``` | ||
``` | ||
httpMsags.send404= function(req, res, resEnd) | ||
Requested page not availeble | ||
``` | ||
``` | ||
httpMsgs.send413 = function(req, res, resEnd) | ||
Requesting for large data, not supported. | ||
``` | ||
#### httpMsgs.send500 = function(req,res,err) | ||
This sends error status with error messages | ||
err = this contains error message | ||
## 500 plus | ||
#### httpMsgs.send405= function(req, res) | ||
Method not supporetd i.e request.methods supported | ||
1. GET | ||
2. POST | ||
#### httpMsags.send404= function(req, res) | ||
Requested page not availeble | ||
#### httpMsgs.send413 = function(req, res) | ||
Requesting for large data, not supported. | ||
``` | ||
httpMsgs.send500(req, res, err, resEnd) | ||
This sends error status with error messages | ||
err = this contains error message | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6907
59