# @xea/koa

> koa

Latest version **0.0.3** (published 2020-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xea/koa
pnpm add @xea/koa
yarn add @xea/koa
bun add @xea/koa
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-04-02 |
| First published | 2020-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | yejiang1015 |
| Maintainers | yejiang |
| Keywords | koa, node |

## Links

- npm: https://www.npmjs.com/package/@xea/koa
- Repository: https://github.com/yejiang1015/xea-koa
- Homepage: https://github.com/yejiang1015/xea-koa#readme
- Issues: https://github.com/yejiang1015/xea-koa/issues
- npm.io page: https://npm.io/package/@xea/koa

## Dependencies (10)

- [koa](https://npm.io/package/koa.md) ^2.11.0
- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [nodemon](https://npm.io/package/nodemon.md) ^2.0.2
- [ts-node](https://npm.io/package/ts-node.md) ^8.8.1
- [cross-env](https://npm.io/package/cross-env.md) ^7.0.2
- [koa2-cors](https://npm.io/package/koa2-cors.md) ^2.0.6
- [@types/koa](https://npm.io/package/@types/koa.md) ^2.11.3
- [koa-router](https://npm.io/package/koa-router.md) ^8.0.8
- [koa-bodyparser](https://npm.io/package/koa-bodyparser.md) ^4.3.0
- [@types/koa-router](https://npm.io/package/@types/koa-router.md) ^7.4.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2020-04-02
- 0.0.2 — 2020-04-02
- 0.0.1 — 2020-04-02

## README

# @xea/koa

## node 模板 快速测试

### install

```bash

yarn add @xea/koa

```

#### packages

```json
{
	"dependencies": {
		"@types/koa": "^2.11.3",
		"@types/koa-router": "^7.4.0",
		"chalk": "^4.0.0",
		"cross-env": "^7.0.2",
		"koa": "^2.11.0",
		"koa-bodyparser": "^4.3.0",
		"koa-router": "^8.0.8",
		"koa2-cors": "^2.0.6",
		"nodemon": "^2.0.2",
		"ts-node": "^8.8.1"
	}
}
```

#### nodemon

```json
{
	"nodemonConfig": {
		"ignore": ["node_modules/", "build/", "dist/"],
		"ext": "ts"
	}
}
```

#### tsconfig.json

```json
{
	"compilerOptions": {
		"target": "esnext",
		"module": "commonjs",
		"lib": ["es2015", "es2016", "es2017", "esnext.asynciterable"],
		"outDir": "build",
		"rootDir": "./",
		"baseUrl": "./",
		"newLine": "CRLF",
		"allowJs": false,
		"skipDefaultLibCheck": true,
		/** 生成 d.ts */
		"declaration": true,
		"noFallthroughCasesInSwitch": true,
		"removeComments": true
	},
	"include": ["**/*.ts", "*.ts"],
	"exclude": ["node_modules/**", "build/**"]
}
```

## use

1. create tsconfig.json
2. index.ts

```js
import * as Koa from "koa";

import { app, listen, route } from "@xea/koa";

route(route => {
	route.get("/", (ctx: Koa.Context) => {
		ctx.body = "hello";
	});

	return route;
});

listen("/apis", 3000);
```

3. scripts

```json
{
	"scripts": {
		"serve": "cross-env NODE_ENV=development nodemon -x ts-node ./index.ts",
		"build": "cross-env NODE_ENV=production node scripts/build",
		"start": "cross-env NODE_ENV=production node build",
		"pm2": "pm2 start npm --name api.webhref -- run start"
	}
}
```

4. start

```bash
yarn serve

```

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