前奏
框架Bud
安装命令:
curl -sf https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh
验证命令:
bud -h
命令提示:
Usage:
bud [flags] [command]
Flags:
-C, --chdir change the working directory
-h, --help show this help message
-L, --log filter logs with this pattern
Commands:
build build your app into a single binary
create create a new app
new scaffold code for your app
run run the dev server
tool extra tools
version show the current version
创建项目:
bud create bud-demo
create: Unable to infer a module name. Try again using the module <path> name.
For example,
bud create --module=github.com/my/app bud-demo
bud create --module=github.com/my/app bud-demo
虽然异常提示,但文件夹已生成
npm ERR! code ETARGET
npm ERR! notarget No matching version found for livebud@0.2.3.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'bud-demo'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yanlili/.npm/_logs/2022-08-29T06_51_21_148Z-debug.log
| exit status 1
cd bud-demo
bud-demo ls
有些文章说是:go.mod node_modules/ package-lock.json package.json待验证
go.mod go.sum package.json
bud run
自动创建bud文件夹,并可以通过 http://127.0.0.1:3000访问默认页面
Listening on http://127.0.0.1:3000
目录结构
bud-demo
├─ bud
│ ├─ app
│ ├─ cache
│ │ └─ PvyE3sgPvhs
│ └─ internal
│ └─ app
│ ├─ main.go
│ └─ web
│ └─ web.go
├─ go.mod
├─ go.sum
└─ package.json