# thinkkoa-ali-serverless

> A lightweight, scalable for agile development Node.js web framework, based on koa2.

Latest version **2.4.14** (published 2019-11-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install thinkkoa-ali-serverless
pnpm add thinkkoa-ali-serverless
yarn add thinkkoa-ali-serverless
bun add thinkkoa-ali-serverless
```

## 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 | 2.4.14 |
| Published | 2019-11-13 |
| First published | 2019-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >8.0.0 |
| Dependencies | 9 |
| Unpacked size | 144.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | richenlin |
| Maintainers | gg1st |
| Keywords | web, nodejs, framework, mvc, es6, koa, restful, agile, think, thinkkoa |

## Links

- npm: https://www.npmjs.com/package/thinkkoa-ali-serverless
- Repository: https://github.com/thinkkoa/thinkkoa
- Issues: https://github.com/thinkkoa/thinkkoa/issues
- npm.io page: https://npm.io/package/thinkkoa-ali-serverless

## Dependencies (9)

- [koa](https://npm.io/package/koa.md) ^2.10.0
- [think_lib](https://npm.io/package/think_lib.md) ^2.x.x
- [think_trace](https://npm.io/package/think_trace.md) ^2.x.x
- [think_loader](https://npm.io/package/think_loader.md) ^2.x.x
- [think_logger](https://npm.io/package/think_logger.md) ^2.x.x
- [think_router](https://npm.io/package/think_router.md) ^2.x.x
- [think_static](https://npm.io/package/think_static.md) ^2.x.x
- [think_payload](https://npm.io/package/think_payload.md) ^2.x.x
- [think_controller](https://npm.io/package/think_controller.md) ^2.x.x

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.4.14 (latest) — 2019-11-13

## README

# 版权归[thinkkoa](https://github.com/thinkkoa/thinkkoa "thinkkoa")所有
# 为了适配阿里serverless，做了少许改动
lib/thinkkoa.js
```js
class ThinkKoa extends koa {
  ...
  init(options){
    ...
    //将listen中的这部分代码移到了这里
      this.captureError();
      //AutoLoader
      loader.loadConfigs(this);
      loader.loadControllers(this);
      loader.loadMiddlewares(this);
      //loader.loadModules(this);

      //emit app ready
      this.emit('appReady');
    // end
  }
}
```
# 使用示例
```js
const serverlessHttp = require('ali-serverless-http');
/**
 * @license    
 * @version    
 */
const path = require('path');
const thinkkoa = require('thinkkoa-ali-serverless');

//thinkkoa instantiation
const app = new thinkkoa({
  root_path: __dirname,
  app_path: __dirname + path.sep + 'app',
  app_debug: false //线上环境请将debug模式关闭，即：app_debug:false
});

//... app is instances of koa

module.exports.handler = serverlessHttp(app);

```

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