UNPKG

jok

Version:

Bundle of utility functions for code generation related to nodejs and graphql

24 lines (16 loc) 448 B
import Express from 'express' import nextjslib from 'next' async function run({ port }) { const express = Express() const nextApp = nextjslib({ dev: true, dir: './src/', }) const nextHandler = nextApp.getRequestHandler() await nextApp.prepare() express.get('*', (req, res) => nextHandler(req, res)) express.listen(port, () => { console.log(`express started at: http://localhost:${port}`) }) } run({ port: 3000 })