# @phenyl/http-server

> Simple HTTP Server to host PhenylRestApi

Latest version **4.2.0** (published 2025-01-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @phenyl/http-server
pnpm add @phenyl/http-server
yarn add @phenyl/http-server
bun add @phenyl/http-server
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2025-01-23 |
| First published | 2019-04-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | Leko |
| Maintainers | shinout, naturalclar, sasurau4, wh1tecat, bowzstandard, alternacrow, camcam-lemon, 1natsu, tainakanchu |

## Links

- npm: https://www.npmjs.com/package/@phenyl/http-server
- Repository: https://github.com/phenyl-js/phenyl
- Homepage: https://github.com/phenyl-js/phenyl#readme
- Issues: https://github.com/phenyl-js/phenyl/issues
- npm.io page: https://npm.io/package/@phenyl/http-server

## Dependencies (2)

- [@phenyl/http-rules](https://npm.io/package/@phenyl/http-rules.md) ^4.2.0
- [@phenyl/interfaces](https://npm.io/package/@phenyl/interfaces.md) ^4.1.0

## Recent versions

- 4.2.0 (latest) — 2025-01-23
- 4.1.0 — 2022-03-16
- 4.0.3 — 2021-02-16
- 4.0.2 — 2021-02-09
- 4.0.1 — 2020-10-24
- 4.0.0 — 2020-10-02
- 3.0.0 — 2020-06-18
- 2.1.0 — 2020-04-01
- 2.0.2 — 2020-03-25
- 2.0.1 — 2020-03-13
- 1.2.0 — 2019-12-26
- 2.0.0 — 2019-12-26
- 1.1.1 — 2019-08-29
- 1.1.0 — 2019-08-29
- 1.0.6 — 2019-08-28
- … 18 more at https://npm.io/package/@phenyl/http-server/versions

## README

# @phenyl/http-server

Simple HTTP Server to host PhenylRestApi

## example

To create a PhenylHttpServer instance, you need to create a PhenylRestApi instance.

```js
import { createServer } from "http";
import PhenylHttpServer from "@phenyl/http-server";
import PhenylRestApi from "@phenyl/rest-api";
import { createEntityClient } from "@phenyl/memory-db";

const entityClient = createEntityClient();

class NonUserDefinition {
  constructor() {}
}

const functionalGroup = {
  nonUsers: { nonUser: new NonUserDefinition() },
  users: undefined,
  customQueries: undefined,
  customCommands: undefined,
};

const restApiHandler = new PhenylRestApi(functionalGroup, {
  entityClient,
  sessionClient: entityClient.createSessionClient(),
});

const server = new PhenylHttpServer(createServer(), { restApiHandler });

server.listen(8080)
```

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