# craydent-http

> Node module http servers and routing

Latest version **1.0.2** (published 2024-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install craydent-http
pnpm add craydent-http
yarn add craydent-http
bun add craydent-http
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2024-09-20 |
| First published | 2018-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 54 |
| Unpacked size | 84 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Clark Inada |
| Maintainers | craydent |
| Keywords | REST, ajax, craydent, es6, express, http, http, jquery, json, koa, library, parser, route, sugar, swagger, utilities |

## Links

- npm: https://www.npmjs.com/package/craydent-http
- Repository: https://github.com/craydent/Node-Library
- Homepage: https://github.com/craydent/Node-Library/tree/master/modules/typeof
- Issues: https://github.com/craydent/Node-Library/issues
- npm.io page: https://npm.io/package/craydent-http

## Dependencies (54)

- [craydent.end](https://npm.io/package/craydent.end.md) 1.0.2
- [craydent.echo](https://npm.io/package/craydent.echo.md) 1.0.2
- [craydent.isie](https://npm.io/package/craydent.isie.md) 1.0.2
- [craydent.send](https://npm.io/package/craydent.send.md) 1.0.2
- [craydent.isie6](https://npm.io/package/craydent.isie6.md) 1.0.2
- [craydent.ismac](https://npm.io/package/craydent.ismac.md) 1.0.2
- [craydent.isipad](https://npm.io/package/craydent.isipad.md) 1.0.2
- [craydent.isipod](https://npm.io/package/craydent.isipod.md) 1.0.2
- [craydent.include](https://npm.io/package/craydent.include.md) 1.0.2
- [craydent.isamaya](https://npm.io/package/craydent.isamaya.md) 1.0.2
- [craydent.isgecko](https://npm.io/package/craydent.isgecko.md) 1.0.2
- [craydent.iskhtml](https://npm.io/package/craydent.iskhtml.md) 1.0.2
- [craydent.islinux](https://npm.io/package/craydent.islinux.md) 1.0.2
- [craydent.isopera](https://npm.io/package/craydent.isopera.md) 1.0.2
- [craydent.vardump](https://npm.io/package/craydent.vardump.md) 1.0.2
- [craydent.http.del](https://npm.io/package/craydent.http.del.md) 1.0.2
- [craydent.http.get](https://npm.io/package/craydent.http.get.md) 1.0.2
- [craydent.http.put](https://npm.io/package/craydent.http.put.md) 1.0.2
- [craydent.http.set](https://npm.io/package/craydent.http.set.md) 1.0.2
- [craydent.ischrome](https://npm.io/package/craydent.ischrome.md) 1.0.2
- [craydent.isiphone](https://npm.io/package/craydent.isiphone.md) 1.0.2
- [craydent.ismobile](https://npm.io/package/craydent.ismobile.md) 1.0.2
- [craydent.ispalmos](https://npm.io/package/craydent.ispalmos.md) 1.0.2
- [craydent.ispresto](https://npm.io/package/craydent.ispresto.md) 1.0.2
- [craydent.isprince](https://npm.io/package/craydent.isprince.md) 1.0.2
- [craydent.issafari](https://npm.io/package/craydent.issafari.md) 1.0.2
- [craydent.iswebkit](https://npm.io/package/craydent.iswebkit.md) 1.0.2
- [craydent.globalize](https://npm.io/package/craydent.globalize.md) 1.0.2
- [craydent.http.post](https://npm.io/package/craydent.http.post.md) 1.0.2
- [craydent.ieversion](https://npm.io/package/craydent.ieversion.md) 1.0.2
- [craydent.isandroid](https://npm.io/package/craydent.isandroid.md) 1.0.2
- [craydent.isfirefox](https://npm.io/package/craydent.isfirefox.md) 1.0.2
- [craydent.issymbian](https://npm.io/package/craydent.issymbian.md) 1.0.2
- [craydent.istrident](https://npm.io/package/craydent.istrident.md) 1.0.2
- [craydent.iswindows](https://npm.io/package/craydent.iswindows.md) 1.0.2
- [craydent.getsession](https://npm.io/package/craydent.getsession.md) 1.0.2
- [craydent.set-header](https://npm.io/package/craydent.set-header.md) 1.0.2
- [craydent.http.commit](https://npm.io/package/craydent.http.commit.md) 1.0.2
- [craydent.http.cookie](https://npm.io/package/craydent.http.cookie.md) 1.0.2
- [craydent.http.delete](https://npm.io/package/craydent.http.delete.md) 1.0.2
- [craydent.http.header](https://npm.io/package/craydent.http.header.md) 1.0.2
- [craydent.createserver](https://npm.io/package/craydent.createserver.md) 1.0.2
- [craydent.getsessionid](https://npm.io/package/craydent.getsessionid.md) 1.0.2
- [craydent.http.payload](https://npm.io/package/craydent.http.payload.md) 1.0.2
- [craydent.isblackberry](https://npm.io/package/craydent.isblackberry.md) 1.0.2
- [craydent.operaversion](https://npm.io/package/craydent.operaversion.md) 1.0.2
- [craydent.writesession](https://npm.io/package/craydent.writesession.md) 1.0.2
- [craydent.chromeversion](https://npm.io/package/craydent.chromeversion.md) 1.0.2
- [craydent.http.rollback](https://npm.io/package/craydent.http.rollback.md) 1.0.2
- [craydent.safariversion](https://npm.io/package/craydent.safariversion.md) 1.0.2
- [craydent.servermanager](https://npm.io/package/craydent.servermanager.md) 1.0.2
- [craydent.firefoxversion](https://npm.io/package/craydent.firefoxversion.md) 1.0.2
- [craydent.getsessionsync](https://npm.io/package/craydent.getsessionsync.md) 1.0.2
- [craydent.iswindowsmobile](https://npm.io/package/craydent.iswindowsmobile.md) 1.0.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2024-09-20
- 1.0.1 — 2024-08-30
- 1.0.0 — 2024-08-23
- 0.15.2 — 2022-08-19
- 0.15.1 — 2022-08-17
- 0.15.0 — 2022-08-16
- 0.14.0 — 2022-08-15
- 0.13.5 — 2021-09-16
- 0.13.4 — 2021-08-09
- 0.13.3 — 2021-08-08
- 0.13.2 — 2021-08-07
- 0.13.1 — 2021-08-04
- 0.13.0 — 2021-07-15
- 0.12.3 — 2021-07-15
- 0.12.2 — 2021-07-15
- … 22 more at https://npm.io/package/craydent-http/versions

## README

<img src="http://craydent.com/JsonObjectEditor/img/svgs/craydent-logo.svg" width=75 height=75/>

# Craydent 1.0.2
**by Clark Inada**

Craydent is all inclusive utility library.  There are several ways to use the library in NodeJS.
More detailed documentation on constants can be found at [Craydent Properties](http://www.craydent.com/JsonObjectEditor/docs.html#/property/CraydentNode).
More detailed documentation on methods can be found at [Craydent Methods](http://www.craydent.com/JsonObjectEditor/docs.html#/method/CraydentNode)

```js
// require with prototypes - this require will add prototypes to extend classes and add two constants ($c, $g) to the global space.
// $g is an alias to global and $c is the constant containing all the utility methods and properties.
require('craydent-http');
$c.logit($c.VERSION);
arr.prototypedMethod(args);
```

```js
// require no conflict - this require is the fully modular version with no global constants, prototypes, or methods.
var $c = require('craydent-http/noConflict');
$c.logit($c.VERSION);
$c.prototypedMethod(arr, args);
```

```js
// require global - this require constants and methods in the global space and add prototypes to extend classes.
// $g is an alias to global and $c is the constant containing all the utility methods and properties.
require('craydent-http/global');
logit($c.VERSION);
arr.prototypedMethod(args);
```

Note: All methods and properties defined in the http module must be used as a property of the context (this) within the createServer callback method.

Craydent is all inclusive utility library.  There are several ways to use the library in NodeJS.
More detailed documentation on constants can be found at [Craydent Properties](http://www.craydent.com/JsonObjectEditor/docs.html#/property/CraydentNode).
More detailed documentation on methods can be found at [Craydent Methods](http://www.craydent.com/JsonObjectEditor/docs.html#/method/CraydentNode)

```js
// require with prototypes - this require will add prototypes to extend classes and add two constants ($c, $g) to the global space.
// $g is an alias to global and $c is the constant containing all the utility methods and properties.
require('craydent-http');
$c.createServer(function(req, res){ this.$GET(); });
```

```js
// require no conflict - this require is the fully modular version with no global constants, prototypes, or methods.
var $c = require('craydent-http/noConflict');
$c.createServer(function(req, res){ this.$GET(); });
```

```js
// require global - this require constants and methods in the global space and add prototypes to extend classes.
// $g is an alias to global and $c is the constant containing all the utility methods and properties.
require('craydent-http/global');
createServer(function(req, res){ this.$GET(); });
```

## Categories

* [Constants](#markdown-header-constants)
* [Properties](#markdown-header-properties)
* [Featured](#markdown-header-featured)
* [HTTP](#markdown-header-http)

<a name='markdown-header-constants'></a>
## Constants

| | | |
| ----- | ----- | ----- |
| ACCEPT_ENCODING (String) |IE (Boolean) |PRINCE (Boolean) |
ACCEPT_LANGUAGE (String) |IE6 (Boolean) |PROTOCOL (String) |
AMAYA (Boolean) |IE7 (Boolean) |PUBLIC_IP (String) |
ANDROID (Boolean) |IE8 (Boolean) |REFERER (String) |
BALANCE_SERVER_LIST (Array) |IE_VERSION (Number) |REFERER_IP (String) |
BLACKBERRY (Boolean) |IPAD (Boolean) |RESPONSES (Object) |
BROWSER (Object) |IPHONE (Boolean) |REST_API_TEMPLATE (String) |
CHROME (Boolean) |IPOD (Boolean) |ROUTE_API_PATH (String) |
CHROME_VERSION (Number) |KHTML (Boolean) |ROUTE_LOGO_URL (String) |
CLIENT (Object) |LINUX (Boolean) |SAFARI (Boolean) |
CONSOLE_COLORS (Object) |LOCAL_IP (String) |SAFARI_VERSION (Number) |
CORES_SUPPORT (Boolean) |MAC (Boolean) |SERVER (String) |
DEBUG_MODE (Boolean) |MODULES_LOADED (Object) |SERVER_PATH (String) |
DEFER_END (Boolean) |OPERA (Boolean) |SYMBIAN (Boolean) |
DEVICE (Object) |OPERA_VERSION (Number) |TEMPLATE_TAG_CONFIG (Object) |
ENGINE (Object) |ORIGIN (String) |TEMPLATE_VARS (Array) |
ERROR_TYPES (Array) |OS (Object) |TRIDENT (Boolean) |
EXPOSE_ROUTE_API (String) |PAGE_NAME (String) |VERBOSE_LOGS (String) |
FIREFOX (Boolean) |PAGE_NAME_RAW (String) |VERSION (String) |
FIREFOX_VERSION (Number) |PALM (Boolean) |WEBKIT (Boolean) |
GEKKO (Boolean) |PRAGMA (String) |WINDOWS (Boolean) |
HTTP_STATUS_TEMPLATE (Object) |PRESTO (Boolean) |WINDOWS_MOBILE (Boolean) |

<a name='markdown-header-properties'></a>
## Properties

| | | |
| ----- | ----- | ----- |
| $l (Object) |raw (String) |server (Object) |
GarbageCollector (Array) |request (Object) |session (Object) |
location (Object) |response (Object) |sessionid (String) |
name (String) |response_sent (Boolean) |
navigator (Object) |rest (Boolean) |

<a name='markdown-header-featured'></a>
## Featured

### HTTP

*** 
#### _$COOKIE_ 
***

**Info:** Get/set Cookies

**Return:** (String|Bool)

**Parameters:**

>* key: (String) Key for cookie value
>* option?: (CookieOptions) Specify delete

**Overloads:**

>Parameters
>* keyValue: (Object) Specify the key value pair: key=>property, value=>object[key]
>* option?: (CookieOptions) Specify path, domain, and/or expiration of cookie

>Parameters
>* key: (String) Key for cookie value
>* value: (any) Value to store
>* option?: (CookieOptions) Specify path and/or expiration of cookie

*** 
#### _$DEL_ 
***

**Info:** Retrieve all or specific variables in the Body

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (VerbOptionsTypes|VerbOptions) Options to defer, ignore case, etc

*** 
#### _$DELETE_ 
***

**Info:** Retrieve all or specific variables in the Body

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (VerbOptionsTypes|VerbOptions) Options to defer, ignore case, etc

*** 
#### _$GET_ 
***

**Info:** Retrieve all or specific variables in the url

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (GetOptions|VerbOptionsTypes|String) Options to defer, ignore case, etc

*** 
#### _$HEADER_ 
***

**Info:** Retrieve all or specific variables in the headers

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (VerbOptionsTypes|VerbOptions) Options to defer, ignore case, etc

*** 
#### _$PAYLOAD_ 
***

**Info:** Retrieve all or specific variables in the Body

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (VerbOptionsTypes|VerbOptions) Options to defer, ignore case, etc

*** 
#### _$POST_ 
***

**Info:** Retrieve all or specific variables in the Body

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (VerbOptionsTypes|VerbOptions) Options to defer, ignore case, etc

*** 
#### _$PUT_ 
***

**Info:** Retrieve all or specific variables in the Body

**Return:** (Bool|Object)

**Parameters:**

>None

**Overloads:**

>Parameters
>* key: (String) key for query value
>* options?: (VerbOptionsTypes|VerbOptions) Options to defer, ignore case, etc



## Methods

<a name='markdown-header-http'></a>
## HTTP

*** 
#### _ChromeVersion_ 
***

**Info:** Get Chrome version

**Return:** (Float)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _FirefoxVersion_ 
***

**Info:** Get Firefox version

**Return:** (Float)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _IEVersion_ 
***

**Info:** Get Internet Explorer version

**Return:** (Float)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _OperaVersion_ 
***

**Info:** Get Opera version

**Return:** (Float)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _SafariVersion_ 
***

**Info:** Get Safari version

**Return:** (Float)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _createServer_ 
***

**Info:** Create http server, ability to run middleware, and define routes.

**Return:** (HTTP)

**Parameters:**

>* callback: (HTTPCallback) Function to callback when a request is received
>* createServer?: (HTTPOptions) Options for creating the server (ex: {createServer:require('http').createServer})

**Overloads:**

>Parameters
>* options: (HTTPOptions) Function to callback when a request is received

*** 
#### _echo_ 
***

**Info:** Echo to buffer and use in response

**Return:** (void)

**Parameters:**

>* output: (String) Data to send in response

**Overloads:**

>None

*** 
#### _end_ 
***

**Info:** Call the next function(s) in queue

**Return:** (void)

**Parameters:**

>None

**Overloads:**

>Parameters
>* status?: (Integer) HTTP status code.
>* output?: (String) output to send as response.
>* encoding?: (String) encoding for the response.

*** 
#### _getSession_ 
***

**Info:** Asynchronous retrieval of the session object when used in conjunction with createServer

**Return:** (Promise<Session>)

**Parameters:**

>* sid: (String) Session id of the session object to retrieve syncronously.
>* callback?: (SessionCallback) callback function to invoke once the session object is retrieved.

**Overloads:**

>None

*** 
#### _getSessionID_ 
***

**Info:** Retrieve the session id when used in conjunction with createServer

**Return:** (String)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _getSessionSync_ 
***

**Info:** Syncronously retrieve the session object when used in conjunction with createServer

**Return:** (Session)

**Parameters:**

>* sid: (String) Session id of the session object to retrieve syncronously.

**Overloads:**

>None

*** 
#### _header_ 
***

**Info:** Set Http Headers to send

**Return:** (void)

**Parameters:**

>* header: (Header) Http header.
>* code?: (Integer) Http response code.

**Overloads:**

>None

*** 
#### _isAmaya_ 
***

**Info:** Check if browser is Amaya

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isAndroid_ 
***

**Info:** Check if device is Android

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isBlackBerry_ 
***

**Info:** Check if device is BlackBerry

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isChrome_ 
***

**Info:** Check if browser is Chrome

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isFirefox_ 
***

**Info:** Check if browser is Firefox

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isGecko_ 
***

**Info:** Check if engine is Gecko

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isIE_ 
***

**Info:** Check if browser is Internet Explorer

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isIE6_ 
***

**Info:** Check if browser is Internet Explorer 6

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isIPad_ 
***

**Info:** Check if device is iPad

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isIPhone_ 
***

**Info:** Check if device is IPhone

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isIPod_ 
***

**Info:** Check if device is IPod

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isKHTML_ 
***

**Info:** Check if engine is KHTML

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isLinux_ 
***

**Info:** Check if OS is Linux

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isMac_ 
***

**Info:** Check if OS is Mac Based

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isMobile_ 
***

**Info:** Check if the device is a Mobile device

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isOpera_ 
***

**Info:** Check if browser is Opera

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isPalmOS_ 
***

**Info:** Check if OS is PalmOS

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isPresto_ 
***

**Info:** Check if engine is Presto

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isPrince_ 
***

**Info:** Check if engine is Prince

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isSafari_ 
***

**Info:** Check if browser is Safari

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isSymbian_ 
***

**Info:** Check if OS is Symbian

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isTrident_ 
***

**Info:** Check if engine is Trident

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isWebkit_ 
***

**Info:** Check if engine is Webkit

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isWindows_ 
***

**Info:** Check if OS is Windows

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isWindowsMobile_ 
***

**Info:** Check if device is Windows Mobile

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _send_ 
***

**Info:** Recursively require the entire directory and returns an object containing the required modules.

**Return:** (void)

**Parameters:**

>* data: (Object) Object to send in response.

**Overloads:**

>Parameters
>* status: (Integer) Status code for response.
>* data: (Object) Object to send in response.

*** 
#### _varDump_ 
***

**Info:** Dump of variables to response.

**Return:** (void)

**Parameters:**

>* ...infinite: (any) any number of arguments can be passed.

**Overloads:**

>None

*** 
#### _writeSession_ 
***

**Info:** Writes session to filesystem to be retrieved later.

**Return:** (void)

**Parameters:**

>None

**Overloads:**

>None




## Download

 * [GitHub](https://github.com/craydent/node-library/modules/http)
 * [BitBucket](https://bitbucket.org/craydent/node-library/modules/http)
 * [GitLab](https://gitlab.com/craydent/node-library/modules/http)
Craydent is released under the [Dual licensed under the MIT or GPL Version 2 licenses](http://craydent.com/license).<br>

---
_Source: https://npm.io/package/craydent-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
