This is a creation in Article, where the information may have evolved or changed.
It is difficult to find a development of high efficiency , easy to start to widely spread , good performance (cost-effective resistance to large concurrent c10k), the deployment of simple (one-click Deployment, no need to configure any environment) of the HTTP project development framework. If there is, then it must be developed with the go language! See a lot of PHP's people have not touched the go language. Think of the past with PHP framework like laravel Development,php-fpm deployment Run, and the days of crazy add machines, tears flow down. Despite the Swoole of this excellent solution. Go's innate underlying network processing advantage is still unique (please forget its syntax). So, I'm going to or have suffered the pain of concurrency, the cost of suffering, the deployment of the heart of the bottom yards farmers recommend a magical language go, as well as a good web development framework gin. Beego? heard a lot of spit groove, not easy to use. Because gin is very "simple", according to some personal development habits, organized a new starter based on gin development skeleton, welcome to download a wave of experience. The following text:
Address: Https://github.com/chenhg5/mo ...
Morninggo:gin WebApp Project Skeleton
Web project development framework based on gin. For reference only.
Higher development Efficiency,
Better performance,
More simple and Tidy project organization structure,
Faster deployment.
Suitable for small projects, medium and large projects (PV high, high complexity of requirements) shift kit, GO-MICRO, kite
Environmental requirements
Project installation Run
Installing with the installer
Installation Project
cd $GOPATH/srcwget https://gitee.com/cg33/morningo-installer/raw/master/morningo-installerchmod +x morningo-installer./morningo-installer --project-name web
Load dependent
cd webmake deps
Test
make test
Smooth restart
make restart
Run
make
Browser Access Http://localhost:4000/api/index
Project deployment
To build an executable file
make build # linus用户make cross # mac/windows用户
build
upload the next file to the production environment server and run it directly. If the port is not port 80, you can configure the Nginx proxy. The files are generated under the folder at the same time pid
, and after each update, the following commands can be performed to smooth the heat.
kill -INT $(cat pid) && ./morningo # 即停止旧的进程,重启新的执行文件
Project Structure
. ├──makefile├──readme.md├──command│ └──sword.go├──config Global Configuration │& Nbsp; └──env.go├──connections Storage Connection │ ├──database│ │ ├──mongod B│ │ └──mysql│ └──redis│ └──redis.go├──controllers Controller │ └──maincontroller.go├──filters Middleware │ └──auth certification Middleware │ ├──drivers Certification Engine │ └──auth.go├──frontend Front-End Resource │ ├──assets│ │ ├──css│ │ ├──images│ │ └──js│ ├──dist│ └──templates│ └──index.tpl├──handle.go Global error handling ├──main.go├──models model │ └──user.go├──module Project Module │&NBsp; └──schedule│ └──schedule.go timed Task Module ├──routers.go Route ├──routers_test. Go API Test ├──storage│ ├──cache cache file │ └──logs Project Log │ ├──access.log│ └──error.log└──vendor Govendor Third Party Package
What's in the box, what's in the box?
HTTP layer (based on gin)
- Routing
- Middleware
- Controller
- Request
- Response
- View
- Session
Front
Safety
- User authentication
- User authorization
- Encrypted decryption
- Hash
General topics
- Dancer Command Line
- Cache system
- Errors and Logs
- Task scheduling
Database
ORM (based on Gorm)
Test
Project Dependencies
- Web framework: Github.com/gin-gonic/gin
- ORM Package: Github.com/jinzhu/gorm
- Redis:github.com/go-redis/redis
- Mysql:github.com/go-sql-driver/mysql
- Wechat:github.com/silenceper/wechat
- Task Scheduler: Github.com/robfig/cron