# @ingress/core

> Core ingress objects, application lifecycle and http handlers

Latest version **1.0.0-beta.16** (published 2023-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ingress/core
pnpm add @ingress/core
yarn add @ingress/core
bun add @ingress/core
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.16 |
| Published | 2023-04-23 |
| First published | 2017-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 123 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Caleb Boyd |
| Maintainers | calebboyd |

## Links

- npm: https://www.npmjs.com/package/@ingress/core
- npm.io page: https://npm.io/package/@ingress/core

## Dependencies (2)

- [injection-js](https://npm.io/package/injection-js.md) ^2.4.0
- [reflect-annotations](https://npm.io/package/reflect-annotations.md) 4.0.0-beta.1

## Recent versions

- 1.0.0-beta.16 (latest) — 2023-04-23
- 1.0.0-beta.2 (beta) — 2017-01-12
- 1.0.0-beta.15 — 2020-03-05
- 1.0.0-beta.13 — 2018-06-15
- 1.0.0-beta.12 — 2018-06-01
- 1.0.0-beta.11 — 2018-04-03
- 1.0.0-beta.10 — 2018-01-15
- 1.0.0-beta.9 — 2017-03-31
- 1.0.0-beta.8 — 2017-03-27
- 1.0.0-beta.7 — 2017-02-10
- 1.0.0-beta.6 — 2017-01-26
- 1.0.0-beta.5 — 2017-01-26
- 1.0.0-beta.4 — 2017-01-22
- 1.0.0-beta.3 — 2017-01-20
- 1.0.0-beta.1 — 2017-01-10

## README

# @ingress/core

`@ingress/core` is a lifecycle container for ecmascript applications

`@ingress/core` manages:
- middleware composition
- startup and shutdown
- dependency injection
- the main application event (the driver)

## Example

The following example uses two Addons (`@ingress/http` and `@ingress/router`) To create an web server.

This will serve 404's since there are no defined routes.

```javascript
import core from '@ingress/core'
import http from '@ingress/http'
import router from '@ingress/router'

const app = core().use(http()).use(router())

app.run()
```

`app.run()` will activate the driver (http) and listen on the environment's defined PORT variable or a random port
A driver, is a middleware that responds to events and executes the core middleware

```typescript
export interface Usable<T> {
  start?: Middleware<Ingress<T>>
  stop?: Middleware<Ingress<T>>
  middleware?: Middleware<T>
  initializeContext?: Func
}
```

The Ingress app itself is also a Usable Addon, allowing nested applications to be composed.


### Why all the classes?

Sometimes classes are viewed as a code smell. While this can certainly be the case, they offer a mechanism of carrying synctactic metadata which can prove useful. Any paradigm can be abused. It's important to make any implementation a focused one.
The goal with ingress is to make composition of your applications easy. So prefer the composition of parts that is catered to.

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