# express-class

> ⌨ TypeScript decorator powered express apps.

Latest version **0.6.0** (published 2020-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-class
pnpm add express-class
yarn add express-class
bun add express-class
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2020-11-08 |
| First published | 2020-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | tnt_man1671 |
| Keywords | express, ts, decorators |

## Links

- npm: https://www.npmjs.com/package/express-class
- Repository: https://github.com/BitSine/express-decorators
- npm.io page: https://npm.io/package/express-class

## Dependencies (1)

- [express](https://npm.io/package/express.md) ^4.17.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.6.0 (latest) — 2020-11-08
- 0.5.0 — 2020-11-01
- 0.4.2 — 2020-11-01
- 0.4.1 — 2020-11-01
- 0.2.0 — 2020-10-31
- 0.1.0 — 2020-10-31

## README

# express-class

⌨ TypeScript decorator powered express apps.

## example

```ts
import { NextFunction, Request, Response } from 'express';
import { get, start, use, resolver } from 'express-class';

// these only need to be loaded. Not instantiated
@resolver('')
class main {
	@get('/')
	req(_req: Request, res: Response, _next: NextFunction) {
		res.status(200);
		res.json({
			e: 'e',
		});
	}

	@get('/hi')
	req2(_req: Request, res: Response, _next: NextFunction) {
		res.status(200);
		res.json({
			msg: 'hello, world!',
		});
	}

	@use()
	mid(req: Request, res: Response, next: NextFunction) {
		console.log(res.statusCode);
		console.log(`running ${req.url}`);

		next();
	}

	@use('/hi', '/api/hi')
	hi(req: Request, res: Response, next: NextFunction) {
		console.log('saying hi');

		next();
	}
}

@resolver('/api')
class resolver2 {
	@get('/hi')
	api(_req: Request, res: Response, _next: NextFunction) {
		res.send('hi');
	}
}

start(8080, () => console.log('started on http://localhost:8080'));
```

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