Giter VIP home page Giter VIP logo

koa-app's Introduction

koa-app

基于 typescript + koa 编写的 node 应用

lang code style: prettier

功能介绍

  • 支持依赖注入
  • 支持多应用模式
  • 支持应用拓展
  • 支持根据环境变量自动读取配置

目录结构

├── package.json
├── tsconfig.json
├── schema.prisma
├── .node-dev.json
├── public/                    # 静态目录
|   └── uploads/               # 上传目录
└── src/
    ├── setup.ts               # 项目启动前执行的脚本
    ├── main.ts                # 项目入口
    ├── app.ts                 # 主应用代码文件
    ├── apps/                  # 可选多应用,里面的子应用可以做成独立的 npm 模块,然后引入   
    |   ├── mobile/  
    |   |    ├── public/       # 静态资源,子应用可以部署自己的
    |   |    └── app.ts        # 子应用代码
    |   |
    |   └── admin/  
    |        ├── public/       # 静态资源,子应用可以部署自己的
    |        └── app.ts        # 子应用代码
    ├── config/                # node-config 配置目录,See: https://github.com/lorenwest/node-config/wiki/Configuration-Files
    |   ├── production.ts
    |   ├── development.ts
    |   └── default.ts
    ├── extend/                 # 拓展 koa 应用的配置文件
    |   ├── request.ts
    |   ├── response.ts
    |   ├── context.ts
    |   └── application.ts
    ├── framework/              # 基于 koa 封装的框架
    |   ├── app.ts
    |   ├── blueprints.ts
    |   ├── decorators.ts
    |   └── router.ts
    ├── interfaces/             # 定义目录
    |   ├── app.ts
    |   ├── blueprints.ts
    |   ├── decorators.ts
    |   └── router.ts
    ├── middleware/             # 中间件
    └── service/                # 内部服务

使用

# 安装依赖
$ npm install

# 创建数据库
$ npm run prisma:generate && npm run prisma:migrate:save && prisma:migrate:up

# 启动开发服务
$ npm run dev

# 启动调试模式,需要其他工具配合,如:vscode,chrome devtools
$ npm run debug

更多 npm version 的命令可使用 npm version --help 查看

License

  • MIT

koa-app's People

Contributors

zhengxs2018 avatar

Watchers

 avatar  avatar  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.