Giter Site home page Giter Site logo

koatty / koatty_demo Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 4.3 MB

Koatty demo.

License: BSD 3-Clause "New" or "Revised" License

TypeScript 23.79% HTML 54.01% JavaScript 3.34% Dockerfile 1.22% Shell 0.31% CSS 17.33%
koatty-demo koatty koa typescript microservice serverless

koatty_demo's Introduction

ktdemo

Application created by Koatty

项目目录结构

projectName
├── .vscode                       # vscode配置
│   └── launch.json               # node本地调试脚本
├── dist                          # 编译后目录
├── src                           # 项目源代码
│   ├── config
│   │   ├── config.ts             # 框架配置
│   │   ├── db.ts                 # 存储配置
│   │   ├── middleware.ts         # 中间件配置
│   │   ├── plugin.ts             # 插件配置
│   │   └── router.ts             # 路由配置
│   ├── controller                # 控制器
│   │   └── TestController.ts
│   ├── middleware                # 中间件
│   │   ├── JwtMiddleware.ts
│   │   └── ViewMiddleware.ts
│   ├── model                     # 持久层
│   │   └── TestModel.ts
│   ├── plugin                    # 插件
│   │   └── TestPlugin.ts
│   ├── proto                     # pb协议
│   │   └── helloworld.proto
│   ├── resource                  # 用于存放静态数据或白名单等
│   │   └── data.json
│   ├── service                   # service逻辑层
│   │   └── TestService.ts
│   ├── utils                     # 工具函数
│   │   └── index.ts
│   └── App.ts                    # 入口文件
├── static                        # 静态文件目录
│   └── index.html
├── test                          # 测试用例
│   └── index.test.js
├── apidoc.json
├── package.json
├── README.md
└── tsconfig.json

启动

# 安装依赖
npm install

# 启动服务
npm start

调试

if you use vscode , edit the .vscode/launch.json , like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "TS Program",
            "args": [
                "${workspaceRoot}/src/App.ts"
            ],
            "runtimeArgs": [
                "--nolazy",
                "-r",
                "ts-node/register"
            ],
            "sourceMaps": true,
            "cwd": "${workspaceRoot}",
            "protocol": "inspector",
            "internalConsoleOptions": "neverOpen"
        }
    ]
}

Select TS Program to debug run. Try to call http://localhost:3000/ .

API 文档

使用 apidoc 模块自动生成接口文档.

npm run doc

接口文档地址:http://localhost:3000/doc/index.html

部署

使用容器化部署, 打包镜像

npm run build:images

发布镜像:

docker push koatty/ktdemo:latest

运行:

docker run -d --network=host --restart=always --name=test koatty/ktdemo:latest

koatty_demo's People

Contributors

dependabot[bot] avatar richenlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wzb549765760

koatty_demo's Issues

typo GetMapping in controller

import { Controller, BaseController, GetMaping, PathVariable, RequestBody } from "koatty";
import { App } from '../App';

@controller()
export class IndexController extends BaseController {
app: App;

/**
 * Custom constructor
 *
 */
init() {
    //...
}

@GetMapping("/")
index(@PathVariable("path") path: string) {
    return this.ok('Hello, Koatty!');
}

}

this repo lack git tags

This repo lack tags / releases, does this mean it works only for latest koatty ?

recommend add git tags for this repo also, for better viewing code changes.

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.