Giter Club home page Giter Club logo

daruk's Introduction

daruk web framework for nodejs


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

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
  • Life cycle and hook.
  • Custom(performance logs & business logs) & tracked
  • Online performance analysis
  • Lightweight link tracking
  • The MVC development of object-oriented
  • Supporting 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 port = 3000;
const myApp = new Daruk('darukProject', {
  rootPath: __dirname,
  debug: process.env.NODE_ENV === 'dev'
});

myApp.listen(port);

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

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):

xiaojue
xiaojue

πŸ’» 🎨
whale
whale

πŸ’» ⚠️
cuzz
cuzz

πŸ’» ⚠️
ζ‰©ζ•£ζ€§η™ΎδΈ‡η”œι’εŒ…
ζ‰©ζ•£ζ€§η™ΎδΈ‡η”œι’εŒ…

⚠️ πŸ’»
arck.liu
arck.liu

πŸ’» πŸ“–

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

daruk's People

Contributors

dxil avatar himself65 avatar myluluy avatar xiaojue avatar youjingyu avatar

Watchers

 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.