diff --git a/Dockerfile b/Dockerfile index 8a0f668..79bde8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,4 @@ COPY . /src # Expose our application port (3000) EXPOSE 3000 - +CMD ["node", "index.js"] diff --git a/app/app.js b/app/app.js index 8805579..fcde730 100644 --- a/app/app.js +++ b/app/app.js @@ -127,7 +127,7 @@ app.post("/api/reviews", (req, res) => { testDBConnection(); // Server -const PORT = 3000; +const PORT = process.env.PORT || 3000; app.listen(PORT, "0.0.0.0", () => { console.log(`Server running on port ${PORT}`); }); \ No newline at end of file diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..ce12627 --- /dev/null +++ b/fly.toml @@ -0,0 +1,12 @@ +app = "softwareengineeringmodulecoursework" +primary_region = "lhr" + +[env] + PORT = "3000" + +[http_service] + internal_port = 3000 + force_https = true + auto_start_machines = true + min_machines_running = 0 + processes = ["app"]