# dragon **Repository Path**: holmescheng/dragon ## Basic Information - **Project Name**: dragon - **Description**: Dragon 🐲 🐲 🐲 is a lightweight high performance web framework with Go for the feature and comfortable develop. - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-07 - **Last Updated**: 2023-02-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Dragon - [start dragon](#start-dragon) - [ab performance](#ab-performance) ![CI Status](https://travis-ci.org/azerothyang/dragon.svg?branch=master) Dragon 🐲 🐲 🐲 is a lightweight high performance web framework with [Go](https://golang.org/) for the feature and comfortable develop. [δΈ­ζ–‡ζ–‡ζ‘£](https://github.com/go-dragon/dragon/blob/main/doc.md) # components 1. [httprouter](https://github.com/julienschmidt/httprouter). HttpRouter is a lightweight high performance HTTP request router. 2. [GORM](https://github.com/jinzhu/gorm). The fantastic ORM library for Golang, aims to be developer friendly. 3. [util](https://pkg.go.dev/github.com/go-dragon/util). for golang common util. 4. [validator](https://pkg.go.dev/github.com/go-playground/validator/v10). google validator to validate the data. 5. [erro](https://pkg.go.dev/github.com/go-dragon/erro). erro pkg aims to wrap the error stack. # start dragon dragon is DDD go framework. So you can hack with handler domain(entity,repository,service). 1. config your yml, first config dev.yml __config__: > dir core/dragon/conf/config/xxx.yml, dev.yml/prod.yml/test.yml/..*** > or you can set env DRAGON in docker 2. build && run your app ``` cd dragon go build main.go && mv main ./release/ && ./release/main ``` > ### move your main(exec file) to release dir 3. IDE config if you use goland ide, can set ``` Output directory: /release Working directory: /release ``` >Because default dragon exec (elf) file output in release dir, so the dirs are resolved according to release dir. >After that, feel free to run your app and start hacking :) 4. deployment you can deploy your app in different environments, only change environment DRAGON, for example. that supports docker. ``` export DRAGON=dev export DRAGON={env} ``` # ab performance ``` cpu: 4 core, ram: 8 G Server Software: nginx/1.12.2 Server Hostname: test.com Server Port: 80 Document Path: / Document Length: 13 bytes Concurrency Level: 100 Time taken for tests: 9.341 seconds Complete requests: 100000 Failed requests: 0 Write errors: 0 Total transferred: 17700000 bytes HTML transferred: 1300000 bytes Requests per second: 73749.75 [#/sec] (mean) Time per request: 9.341 [ms] (mean) Time per request: 0.093 [ms] (mean, across all concurrent requests) Transfer rate: 1850.51 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 1.2 1 9 Processing: 0 8 2.7 8 30 Waiting: 0 7 2.5 6 29 Total: 0 9 2.9 9 31 Percentage of the requests served within a certain time (ms) 50% 9 66% 10 75% 11 80% 11 90% 13 95% 14 98% 16 99% 18 100% 31 (longest request) ``` app will read DRAGON env first to check prod,dev or test mode __build__: >Just compile your src file and move bin file to directory dragon/release/ >you might develop with [fswatch](https://github.com/codeskyblue/fswatch) for hot rebuilding. just create .fsw.json config: ``` { "desc": "Auto generated by fswatch [dragon]", "triggers": [ { "name": "", "pattens": [ "**/*.go" ], "env": { "DEBUG": "1" }, "cmd": "go fmt dragon... && go build -o ./release/dragon && ./release/dragon", "shell": true, "delay": "100ms", "stop_timeout": "500ms", "signal": "KILL", "kill_signal": "" } ], "watch_paths": [ "." ], "watch_depth": 10 } ``` > just run cmd and it can autoupdate ``` $ fswatch ```