web framework written in go
1.Install go
2.Use below command insatall goweb
go get -u github.com/awaketai/goweb
buid a execute file
cd build
make build
then project root file generate a execute file named gw,run it
webserver will read root dir .env file,the env contains:development | testing | production
app will read command ADDRESS parameter,if this parameter not set,the config dir app.yaml file will be read,and the address parameter will be load,if above parameter not set both,default address:8080
1.env command address
ADDRESS=:8081 ./gw app start
- app.yaml address
config/development:
address: 8081
3.command address
./gw app start --address=:8081
start app server daemon
./gw app start --daemon=true
or
./gw app start --d=true
./gw app start
./gw app restart
./gw app stop
1.run following command generage file releated to swagger
gw swagger gen
will be generated some file to app/http/swagger
2.run app server,then serve will be listening port:8080,then browse: localhost:8080/swagger/index.html
1.config
the database config file app/config/{env}/database.yaml will be load,and database argument database.default will be load if config path not assignment.assign config path:
gormService := c.MustMake(contract.ORMKey).(contract.ORM)
gormService.GetDB(orm.WithConfigPath("database.default"))
when getdb success,we will get a gorm DB instance,use this DB instance,we can operate database, such as Migrate,Create,Update,Delete and so on. specific doc:gorm
simple database operate demo reference:app/http/module/demo/orm_demo.go
Thanks to jetbrains for supporting this project