1
2
3
4
5
6
7
8
9
10
| flutter channel beta
flutter upgrade
flutter config --enable-web
flutter devices
Chrome • chrome • web-javascript • Google Chrome 78.0.3904.108
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
mkdir node
mkdir server
cd node/server
npm install express-generator -g //安装好了略过
express --view=pug myapp
cd myapp
npm i
npm start
|
1
2
| mkdir bin
touch bin/test_start_node.sh
|
1
2
3
4
5
6
7
8
9
10
|
#!/usr/bin/env bash
# 构建Web
flutter build web
# 拷贝web内容到node目录
cp -r build/web/ node/server/myapp/public_flutter_web/
# 启动服务
node node/server/myapp/bin/www
|
1
2
| app.use(express.static(path.join(__dirname, 'public_flutter_web')));
|
1
2
3
| ./bin/test_start_node.sh
|