Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darukjs/daruk
a node.js web framework based on typescript
https://github.com/darukjs/daruk
node-framework nodejs typescript
Last synced: 10 days ago
JSON representation
a node.js web framework based on typescript
- Host: GitHub
- URL: https://github.com/darukjs/daruk
- Owner: darukjs
- License: mit
- Created: 2019-03-12T02:19:13.000Z (over 5 years ago)
- Default Branch: 2.0
- Last Pushed: 2024-02-29T07:20:29.000Z (8 months ago)
- Last Synced: 2024-04-14T09:04:51.098Z (7 months ago)
- Topics: node-framework, nodejs, typescript
- Language: TypeScript
- Homepage: http://darukjs.com
- Size: 1.74 MB
- Stars: 936
- Watchers: 33
- Forks: 79
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome - darukjs/daruk - a node.js web framework based on typescript (TypeScript)
- awesome-nodejs - daruk - A node.js web framework based on typescript. ![](https://img.shields.io/github/stars/darukjs/daruk.svg?style=social&label=Star) (Repository / Web Frameworks)
- awesome-github-star - daruk
- awesome-luooooob - darukjs/daruk - a node.js web framework based on typescript (TypeScript)
- awesome-zod - `daruk` - A Node.js web framework based on typescript. (Projects Using Zod)
README
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![PR's Welcome][pr-welcoming-image]][pr-welcoming-url]
![GitHub closed issues](https://img.shields.io/github/issues-closed/darukjs/daruk.svg)
![npm](https://img.shields.io/npm/dm/daruk.svg)
[![codecov](https://codecov.io/gh/darukjs/daruk/branch/developer/graph/badge.svg)](https://codecov.io/gh/darukjs/daruk)
![GitHub top language](https://img.shields.io/github/languages/top/darukjs/daruk.svg)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/darukjs/daruk.svg)
[![Package Quality](https://npm.packagequality.com/shield/daruk.svg)](https://packagequality.com/#?package=daruk)
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/darukjs/daruk/2.0.svg)
[![Gitter](https://badges.gitter.im/daruk_framework/community.svg)](https://gitter.im/daruk_framework/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![start with why](https://img.shields.io/badge/start%20with-why%3F-brightgreen.svg?style=flat)](https://v.youku.com/v_show/id_XNDExMjA5MTI2NA==.html?spm=a2hzp.8244740.0.0)
![GitHub language count](https://img.shields.io/github/languages/count/darukjs/daruk.svg)
![APM](https://img.shields.io/apm/l/vim-mode.svg)
[![Build Status](https://dev.azure.com/designsor/daruk/_apis/build/status/darukjs.daruk?branchName=developer)](https://dev.azure.com/designsor/daruk/_build/latest?definitionId=3&branchName=developer)## 讨论群
https://github.com/darukjs/daruk/issues/129
## 开源实践
http://blog.7hds.com/ 博客后端
https://github.com/hedongshu/hds-blog-api
## Daruk
[Daruk](https://darukjs.com) 是一款基于 Koa2,使用 Typescript 开发的轻量级 web 框架。Daruk 的初衷是让人们可以更方便的开发 Nodejs Web 应用并能够体会到 Typescript 编程的乐趣。Daruk 本身基于 100%基于 Typescript 开发,使用 inversifyjs 的 IoC 容器管理依赖,让开发者享受最佳的 OOP 和 IoC 的编程体验。
框架内部集成了许多方便灵活的装饰器函数,让开发者可以写更少的代码来完成更多的事情,Daruk2.0 更改了之前严格要求目录约定的范式,提供给开发者更灵活的操作空间来进行项目约束和编写,但是内置的功能并没有缺失,整个框架的开发能力和 Daruk1.0 能力持平。
比如在 Daruk2.0 中,我们可以使用装饰器来快速定义 service,controller,timer,middleware 等能力来编写 web 应用,且提供了一些基本的内置中间件和路由服务等,更灵活的定义,让 Daruk2.0 可以更灵活的定制你的 web 项目和编写测试脚本。
Daruk 来源自塞尔达传说旷野之息里的四英杰之一,拥有在周围张开结界保护自己的力量,框架的目的也是为了给 nodejs server 提供健壮的基础管理能力。
Daruk2.0 同样基于 koa2,目前包含以下核心功能:
- 开启装饰器配置,ts 环境下引入即用,无需脚手架等工具。
- 提供给开发者编写影响框架内部能力的插件机制
- 可以自定义目录结构,在启动时使用 API 加载你自己定义的源文件
- 完整的 typescript 开发体验
- 服务启动完整生命周期 hook
- 自定义(性能日志 & 业务日志) 染色功能
- 支持线上实时性能分析
- 轻量级的链路追踪
- 面向对象的 mvc 开发体验
- 配套的一些周边模块## Installation & Quick start
安装
```bash
mkdir daruk-demo
cd daruk-demo
npm init
npm add daruk ts-node typescript
mkdir src
touch src/index.ts
```开始编写 web 应用 `src/index.ts`
```typescript
import { DarukServer, controller, get, DarukContext } from 'daruk';(async () => {
const myapp = DarukServer();@controller()
class Index {
@get('/')
public async index(ctx: DarukContext) {
ctx.body = 'hello world';
}
}await myapp.binding();
myapp.listen(3000);
})();
```创建编译时的 `tsconfig.json` 文件
```bash
touch tsconfig.json
``````json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"sourceMap": true,
"outDir": "./build",
"rootDir": "./src",
"typeRoots": [],
"types": [],
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"exclude": ["node_modules"],
"include": ["./src/**/*.ts"]
}
```编辑 `package.json` 的启动和编译脚本
```json
{
"scripts": {
"dev": "NODE_ENV=dev ts-node --project tsconfig.json --files src/index.ts",
"build": "tsc"
}
}
```启动服务
```bash
npm run dev
> NODE_ENV=dev ts-node --project tsconfig.json --files src/index.ts
[2020-9-1 19:52:12] [debug] [init] [router] get - /
```打包脚本并启动编译后的脚本
```bash
npm run build
node build/index.js
```## Docs
查看 Daruk 文档[快速开始](https://darukjs.com/)吧! TypeDoc 则可以从这里开始 [API DOC](https://doc.darukjs.com/)吧!
## Example
查看实际的 web 服务例子 [example](https://github.com/darukjs/daruk/tree/2.0/example)
[daruk-demo](https://github.com/darukjs/daruk-demo)
使用腾讯云应用一键部署:
[](https://www.cloudbase.net/marketplace.html)
## 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](https://github.com/darukjs/daruk/blob/2.0/CONTRIBUTING.md)
[npm-image]: https://img.shields.io/npm/v/daruk.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/daruk
[travis-image]: https://api.travis-ci.com/darukjs/daruk.svg?branch=developer
[travis-url]: https://travis-ci.com/darukjs/daruk
[pr-welcoming-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[pr-welcoming-url]: https://github.com/darukjs/daruk/pull/new## Some companies using Daruk
## Contributors
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
xiaojue
💻 🎨
whale
💻 ⚠️
imakan
💻
cuzz
💻 ⚠️
扩散性百万甜面包
⚠️ 💻
arck.liu
💻 📖
Manjusaka
💻
KenyeeCheung
💻
ChasLui
📖
木杉
💻
icepy
💻
jeffjing
💻
yiliang
📖
imakan
💻
WangHan
📖
zuigzm
🐛 💻
南北
💻 📖
凌
💻 📖
Zerui Hu
⚠️ 💻
薛定谔の狗狗
⚠️ 💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!