1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

use native http instead of micro (#5706)

This commit is contained in:
Tim Neutkens 2018-11-19 16:36:18 +01:00 committed by GitHub
parent e1f6f34f86
commit 9547e77820
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View file

@ -55,7 +55,6 @@
"jest-cli": "23.6.0",
"lerna": "^3.4.0",
"lint-staged": "4.2.3",
"micro": "9.1.0",
"mkdirp": "0.5.1",
"node-fetch": "1.7.3",
"node-notifier": "5.1.2",

View file

@ -899,14 +899,14 @@ Here's an example usage of it:
```js
const next = require('next')
const micro = require('micro')
const http = require('http')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handleNextRequests = app.getRequestHandler()
app.prepare().then(() => {
const server = micro((req, res) => {
const server = new http.Server((req, res) => {
// Add assetPrefix support based on the hostname
if (req.headers.host === 'my-app.com') {
app.setAssetPrefix('http://cdn.com/myapp')

View file

@ -1,4 +1,4 @@
const micro = require('micro')
const http = require('http')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
@ -9,7 +9,7 @@ const app = next({ dev, dir })
const handleNextRequests = app.getRequestHandler()
app.prepare().then(() => {
const server = micro((req, res) => {
const server = new http.Server((req, res) => {
if (/setAssetPrefix/.test(req.url)) {
app.setAssetPrefix(`http://127.0.0.1:${port}`)
} else if (/setEmptyAssetPrefix/.test(req.url)) {

View file

@ -1,4 +1,4 @@
const micro = require('micro')
const http = require('http')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
@ -9,7 +9,7 @@ const app = next({ dev, dir })
const handleNextRequests = app.getRequestHandler()
app.prepare().then(() => {
const server = micro((req, res) => {
const server = new http.Server((req, res) => {
if (/setAssetPrefix/.test(req.url)) {
app.setAssetPrefix(`http://127.0.0.1:${port}`)
} else if (/setEmptyAssetPrefix/.test(req.url)) {