# @webgeek/basic-express-decorators

> Basic Decorators for Express with support for `express-validator`

Latest version **1.0.3** (published 2021-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @webgeek/basic-express-decorators
pnpm add @webgeek/basic-express-decorators
yarn add @webgeek/basic-express-decorators
bun add @webgeek/basic-express-decorators
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-03-02 |
| First published | 2021-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Junrey Beduya |
| Maintainers | webgeek |
| Keywords | express, validator, typescript, decorators |

## Links

- npm: https://www.npmjs.com/package/@webgeek/basic-express-decorators
- Repository: https://github.com/jbeduya/basic-express-decorators
- Homepage: https://github.com/jbeduya/basic-express-decorators#readme
- Issues: https://github.com/jbeduya/basic-express-decorators/issues
- npm.io page: https://npm.io/package/@webgeek/basic-express-decorators

## Dependencies (4)

- [express](https://npm.io/package/express.md) ^4.17.1
- [@types/express](https://npm.io/package/@types/express.md) ^4.17.11
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [express-validator](https://npm.io/package/express-validator.md) ^6.10.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2021-03-02
- 1.0.2 — 2021-03-02
- 1.0.1 — 2021-03-02
- 1.0.0 — 2021-03-02

## README

# basic-express-decorators

Basic Decorators for Express - Includes supports for `express-validator` using Typescript

Checkout this repository https://github.com/jbeduya/basic-express-decorators-demo for more information.

# Installation

```
npm install @webgeek/basic-express-decorators
```

## Update your `tsconfig.json`

Enable the following:

```json
{
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
```

# Usage

Let's say you have  `controllers` folder. Create two files under it.

`home.ts`

```typescript
import { controller, get } from "basic-express-decorators";
import { Request, Response } from 'express';

@controller()
export class HomeController {
    @get('/')
    index(req: Request, res: Response) {
        res.send('Hello World')
    }

    @get('/demo')
    demo(req: Request, res: Response) {
        res.json({ message: 'This is just a demo'})
    }
}
```

`index.ts`
```typescript
export * from './home'
```

In your express app, do the following:

```typescript
import express from 'express';
import { Router } from 'basic-express-decorators'
import './controllers'

const app = express();
app.use(Router.getInstance())

app.listen(8000, () => console.log('Listening at http://localhost:8000'))
```

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