Unverified Commit 9547e778 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

use native http instead of micro (#5706)

parent e1f6f34f
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
"jest-cli": "23.6.0", "jest-cli": "23.6.0",
"lerna": "^3.4.0", "lerna": "^3.4.0",
"lint-staged": "4.2.3", "lint-staged": "4.2.3",
"micro": "9.1.0",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"node-fetch": "1.7.3", "node-fetch": "1.7.3",
"node-notifier": "5.1.2", "node-notifier": "5.1.2",
......
...@@ -899,14 +899,14 @@ Here's an example usage of it: ...@@ -899,14 +899,14 @@ Here's an example usage of it:
```js ```js
const next = require('next') const next = require('next')
const micro = require('micro') const http = require('http')
const dev = process.env.NODE_ENV !== 'production' const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev }) const app = next({ dev })
const handleNextRequests = app.getRequestHandler() const handleNextRequests = app.getRequestHandler()
app.prepare().then(() => { app.prepare().then(() => {
const server = micro((req, res) => { const server = new http.Server((req, res) => {
// Add assetPrefix support based on the hostname // Add assetPrefix support based on the hostname
if (req.headers.host === 'my-app.com') { if (req.headers.host === 'my-app.com') {
app.setAssetPrefix('http://cdn.com/myapp') app.setAssetPrefix('http://cdn.com/myapp')
......
const micro = require('micro') const http = require('http')
const next = require('next') const next = require('next')
const dev = process.env.NODE_ENV !== 'production' const dev = process.env.NODE_ENV !== 'production'
...@@ -9,7 +9,7 @@ const app = next({ dev, dir }) ...@@ -9,7 +9,7 @@ const app = next({ dev, dir })
const handleNextRequests = app.getRequestHandler() const handleNextRequests = app.getRequestHandler()
app.prepare().then(() => { app.prepare().then(() => {
const server = micro((req, res) => { const server = new http.Server((req, res) => {
if (/setAssetPrefix/.test(req.url)) { if (/setAssetPrefix/.test(req.url)) {
app.setAssetPrefix(`http://127.0.0.1:${port}`) app.setAssetPrefix(`http://127.0.0.1:${port}`)
} else if (/setEmptyAssetPrefix/.test(req.url)) { } else if (/setEmptyAssetPrefix/.test(req.url)) {
......
const micro = require('micro') const http = require('http')
const next = require('next') const next = require('next')
const dev = process.env.NODE_ENV !== 'production' const dev = process.env.NODE_ENV !== 'production'
...@@ -9,7 +9,7 @@ const app = next({ dev, dir }) ...@@ -9,7 +9,7 @@ const app = next({ dev, dir })
const handleNextRequests = app.getRequestHandler() const handleNextRequests = app.getRequestHandler()
app.prepare().then(() => { app.prepare().then(() => {
const server = micro((req, res) => { const server = new http.Server((req, res) => {
if (/setAssetPrefix/.test(req.url)) { if (/setAssetPrefix/.test(req.url)) {
app.setAssetPrefix(`http://127.0.0.1:${port}`) app.setAssetPrefix(`http://127.0.0.1:${port}`)
} else if (/setEmptyAssetPrefix/.test(req.url)) { } else if (/setEmptyAssetPrefix/.test(req.url)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment