Skip to content

Instantly share code, notes, and snippets.

@Dru89
Created July 17, 2017 22:22
Show Gist options
  • Save Dru89/dd550ad268be9eb680cf2d0a6a661970 to your computer and use it in GitHub Desktop.
Save Dru89/dd550ad268be9eb680cf2d0a6a661970 to your computer and use it in GitHub Desktop.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const url = require("url");
const express = require("express");
const next_1 = require("next");
const dev = process.env.NODE_ENV !== 'production';
const app = next_1.default({ dev });
const handle = app.getRequestHandler();
app.prepare()
.then(() => {
const server = express();
server.get('*', (req, res) => {
return handle(req, res, url.parse(req.url));
});
server.listen(3000, (err) => {
if (err)
throw err;
console.log('> Ready on http://localhost:3000');
});
});
import * as url from 'url';
import * as express from 'express';
import next from 'next';
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
app.prepare()
.then(() => {
const server = express()
server.get('*', (req, res) => {
return handle(req, res, url.parse(req.url));
})
server.listen(3000, (err: any) => {
if (err) throw err
console.log('> Ready on http://localhost:3000')
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment