Public Repository

Last pushed: 7 months ago
Short Description
Base NGINX with Node + express
Full Description

1.11, latest: Dockerfile

Edit NGINX

default.conf

...
    location / {
      proxy_pass http://localhost:8080;
    }
...

Edit Express server.js

server.js

var express = require('express')
var path = require('path')
var compression = require('compression')

var app = express()
app.use(compression())

// serve our static stuff like index.css
app.use(express.static(path.join(__dirname, 'dist')))

// send all requests to index.html so browserHistory in React Router works
app.get('*', function (req, res) {
 res.sendFile(path.join(__dirname, 'dist', 'index.html'))
})

var PORT = process.env.PORT || 8080
app.listen(PORT, function() {
  console.log('Production Express server running at localhost:' + PORT)
})
Docker Pull Command
Owner
iaguilar

Comments (0)