官方文档 https://gobuffalo.io
安装
安装要求
Before installing make sure you have the required dependencies installed:
- A working Go environment
- Go version
v1.16.0
.Frontend Requirements#
The following requirements are optional. You don’t need them if you want to build an API or if you prefer to build your app in an old-fashioned way.
- node version
8
or greater- either yarn or npm for the asset pipeline built upon webpack.
Database Specific Requirements#
Again, if you don’t need a database, you won’t need these.
- SQLite 3: GCC, or equivalent C compiler for mattn/go-sqlite3.
使用下面的命令安装cli及相关工具
go install github.com/gobuffalo/cli/cmd/[email protected]
go install github.com/gobuffalo/buffalo-pop/[email protected]
如果需要sqlite支持,请使用下面的命令
go install -tags sqlite github.com/gobuffalo/cli/cmd/[email protected]
go install -tags sqlite github.com/gobuffalo/buffalo-pop/[email protected]
因为国内的原因,npm等组件可能因为某些原因下载不了,可以通过下面的内容设置mirror
npm config set registry https://registry.npmmirror.com
yarn工具设置代理
yarn config set https-proxy http://host:port
yarn config set proxy http://host:port
创建项目及运行
通过下面命令创建项目
buffalo new tinyApp --db-type sqlite3
然后切换到tiny_app目录,运行
buffalo dev
运行效果如下