npm.io
1.0.0-rc.1 • Published 7 years ago

next-serverless-server

Licence
MIT
Version
1.0.0-rc.1
Deps
0
Size
78 kB
Vulns
0
Weekly
0
Stars
1

Next.js Serverless Server

A plain Node.js server that serves a Next.js app built for the serverless target.

Installation

npm install --save next-serverless-server

Usage

const server = require('next-serverless-server')

server(__dirname).listen(3000, (err) => {
  if (err) throw err

  console.log('> Ready on http://localhost:3000')
})

API

server(root: string): http.Server

Creates a new http.Server with a request handler attached for serving the Next.js app.

The root argument should be the path to the folder of your app, that is the folder that contains the .next folder.

Note that your Next.js app must be built with the target: 'serverless' option specified.