Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy nodejs express to display the out-html #78

Open
chineping opened this issue Apr 28, 2023 · 0 comments
Open

Deploy nodejs express to display the out-html #78

chineping opened this issue Apr 28, 2023 · 0 comments

Comments

@chineping
Copy link

Deploy node js to display the out-html
docker-compose docker-compose.yml and add server.js to out-html (refs:https://stackoverflow.com/questions/13339695/nodejs-w-express-error-cannot-get )

$ cat docker-compose.yml

version: "3"
services:
node:
image: node:16
container_name: gerritstats-3003
hostname: node
ports:
- "3003:3000"
working_dir: /app
volumes:
- ./out-html:/app
command: ["/bin/bash", "-c", "npm add express && node server.js"]
restart: always

$ cat out-html/server.js

const express = require('express')
const app = express()
const port = 3000

app.use(express.static(__dirname));
app.listen(port, () => {
console.log(Example app listening at http://localhost:${port})
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant