Netlify 并不能让托管 Express Web 应用程序变得容易。我希望您会发现本指南很有用。
package.json 可以如下所示:
"scripts": { "start": "node ./functions/server.js", "build": "netlify deploy --prod", "build-dev": "NODE_ENV=development webpack --mode development --watch", "dev": "NODE_ENV=development node server-local.js", "dev-watch": "NODE_ENV=development nodemon --exec node server-local.js", },
编写 server.mjs 代码,如图所示:
[functions] included_files = [ "static/views/**" # Include all files in static/views for server-side access ]
[build] publish = "static" # Static assets to be served by Netlify's CDN. Folder defaults to public
以上是如何在 Netlify 上部署 Node.js Express 应用(4)的详细内容。更多信息请关注PHP中文网其他相关文章!