Custom server

You can use Ream with any Node.js server framework or the default http module, here's a quick example for using with Express.js:

📝 server.js:

const server = require('express')()
const ream = require('ream')

const port = process.env.PORT || 3000
const config = require('./ream.config')
const app = ream({
  dev: process.env.NODE_ENV !== 'production',
  ...config
})

app.getRequestHandler()
  .then(handler => {
    server.get('*', handler)

    server.start(port)
    console.log(`> Ready on http://localhost:${port}`)
  })

Check out the source code of the examples: