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中文網其他相關文章!