daruk

a node.js web framework based on typescript

Github星跟蹤圖

NPM version
build status
PR's Welcome
GitHub closed issues
npm
codecov
GitHub top language
GitHub code size in bytes
Package Quality
All Contributors
GitHub last commit (branch)
Gitter
start with why
GitHub language count
APM
Build Status

Daruk

Chinese Document

Daruk is a lightweight web framework base on Koa and written in Typescript. Koa is original http server implementation if you used it. In the daily development,we have to use many open source middleware in Koa to implement scaffold, routing, abstraction and some components such as logging, monitoring, etc.

We can create your web project by Daruk scaffold for business. Daruk core is lightweight and easy extension and learing, but it can provides more options for developer to rapid development such as constraints directory specification and code style.

Daruk, it comes from The Legend of Zelda: Breath of the Wild one of the four heroes, it have symbol of guardian ability. The goal of the framework is also as it.

Daruk is base on Koa2, includes features:

  • Scaffolding
  • Directory and file specification
  • Auto loader and decorator combination
  • Complete Typescript development experience
  • Lifecycle and hook.
  • Custom(performance logs & business logs) & tracked
  • Online performance analysis
  • Lightweight link tracking
  • The MVC development of object-oriented
  • Support the development of the module

Installation scaffolding

# install daruk scaffold cli
$ cnpm i -g daruk-cli

# init project
# --ignore ignore local template cache
$ daruk init --ignore daruk-example

# run the project
$ cd daruk-example
$ npm run dev

Quick start

You can write your code shown below :

import { Daruk } from 'daruk';

const myApp = new Daruk('darukProject', {
  rootPath: __dirname,
  debug: process.env.NODE_ENV === 'dev'
});

myApp.listen(process.env.PORT, 3000);

controllers/index.ts:

import { BaseController, config, Context, Daruk, get, middleware, util } from 'daruk';

export default class Index extends BaseController {
  @util('getToday')
  public getToday: Daruk['util']['getToday'];

  @config('author')
  public author: Daruk['config']['author'];

  @config('version')
  public version: Daruk['config']['version'];

  @middleware('cors')
  @get('/')
  public async index(ctx: Context, next: Function) {
    const weather = await ctx.service.weather.getWeather();
    ctx.body = `Hi, ${this.author}, project version is ${
      this.version
    }, Today is ${this.getToday()}, weather is ${weather}`;
  }
}

More information you can check out example/03-weather.

Docs

More docs: Quick Start

Features Todo

Beta TodoList

How to Contribute

Please let us know how can we help. Do check out issues for bug reports or suggestions first.

To become a contributor, please follow our contributing guide

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

主要指標

概覽
名稱與所有者darukjs/daruk
主編程語言TypeScript
編程語言JavaScript (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2019-03-12 02:19:13
推送於2024-02-29 07:20:29
最后一次提交
發布數15
最新版本名稱v2.4.13 (發布於 )
第一版名稱v0.5.6 (發布於 2019-05-16 19:38:42)
用户参与
星數0.9k
關注者數31
派生數81
提交數537
已啟用問題?
問題數54
打開的問題數9
拉請求數64
打開的拉請求數0
關閉的拉請求數18
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?