#!/usr/bin/env node
/* @flow */
import { serve } from 'aspect/src/adapters/server'

async function run(): Promise<void> {
  const server = await serve({
    port: 'PORT' in process.env ? Number(process.env.PORT) : null
  })
  console.log(`Running server at http://127.0.0.1:${server.port}`)
}

run()

#!/usr/bin/env node
/* @flow */
import { serve } from 'aspect/src/adapters/server'
import { parseEnv, optional } from 'env'

async function run(): Promise<void> {
  const config = parseEnv({
    PORT: optional(Number)
  })

  const server = await serve({
    port: config.PORT
  })
  console.log(`Running server at http://127.0.0.1:${server.port}`)
}

run()

Use env library to parse config out of environment
Use env library to parse config out of environment
