我正在使用netlify开发人员来运行netlify lambda函数的React应用。
我只需运行
即可启动开发服务器 netlify dev
现在,我可以通过localhost:3000访问我的应用程序,也可以通过localhost:3000/.netlify/functions/...
-来运行netlify函数。
但是我想使用在/ etc / hosts中配置的主机名-例如:abc-website.local
它可以访问react应用,但无法连接到功能。
netlify toml文件中是否存在用于配置主机名的参数?
到目前为止,这是我的toml文件:
[build]
functions = "functions"
[dev]
command = "yarn start"
port = 3000
publish = "dist"
这是我运行netlify dev时的输出
◈ Netlify Dev ◈
◈ Injected build setting env var: MONGODB_URL
◈ Starting Netlify Dev with create-react-app
Waiting for localhost:3000.
◈ Lambda server is listening on 34567
yarn run v1.16.0
$ react-scripts start
.Starting the development server...
.
Connected!
Waiting for localhost:34567.
Connected!
┌─────────────────────────────────────────────────┐
│ │
│ ◈ Server now ready on http://localhost:3000 │
│ │
└─────────────────────────────────────────────────┘
Compiled successfully!
You can now view abc in the browser.
Local: http://localhost:3000/
On Your Network: http://192.168.1.105:3000/
Note that the development build is not optimized.
To create a production build, use yarn build.
这是netlify开发人员的文档
https://github.com/netlify/cli/blob/master/docs/netlify-dev.md