Code Monkey home page Code Monkey logo

ts-koa's Introduction

ts-koa

A typescript Node.JS web API lite framework based on Koa, and this framework is also be used in Teambition

Intro

1.the structure

ts-koa
├── package.json
├── src
│   ├── controller
│   |   └── base.ts
│   ├── service
|   |   ├── ajv.ts
│   |   └── logger.ts
│   ├── blls
│   |   └── hello.ts
│   ├── public
│   ├── app.ts
│   ├── global.d.ts
│   ├── loader.ts
│   ├── router.ts
│   └── types.d.ts
├── config
|   └── default.yml
└── test
  • src/controller/** API 路由
  • src/blls/** 业务逻辑层
  • config/defuault.yml 编写配置文件
  • test/** 单元测试
  • app.ts 应用初始化

How to use

1.use git clone

~ cd <your namespace> && git clone [email protected]:richardwei195/ts-koa.git && cd ts-koa && npm i

2.rename you project name in project.json

3.custom your lint style in tslint.json

you can see https://palantir.github.io/tslint to find you want.

4.now you can run your application on your computer or any others

~ npm run dev

> nodemon --watch 'src/**/*.ts' --exec ts-node src/app.ts

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: src/**/*.ts
[nodemon] starting `ts-node src/app.ts`
koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.md src/app.ts:8:5
Server listen on 3000

Becarefully, this is a demo route in the path: /src/controller/hello.ts, so you can request this route: localhost:3000/hello-world

and it will return hello World!, yea!

how to build

ts-koa's People

Contributors

richardwei195 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.