npm.io
0.6.0 • Published 4 years ago

@machinat/next

Licence
MIT
Version
0.6.0
Deps
1
Size
23 kB
Vulns
0
Weekly
0
Stars
32

Next Module

This package is an underlying module of webview platform for serving a Next.js web front-end. You might want to use @machinat/webview unless you want to serve your own web service.

Install

npm install @machinat/core @machinat/http @machinat/next
# or with yarn
yarn add @machinat/core @machinat/http @machinat/next

Docs

Check the package reference.

Setup

Assume you have the Next.js project at ../webview, set up the module like this:

import Machinat from '@machinat/core';
import Http from '@machinat/http';
import Next from '@machinat/next';
import nextConfigs from '../webview/next.config.js'

const DEV = process.env.NODE_ENV !== 'production';

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
    Next.initModule({
      entryPath: '/webview',   // have to match bastPath in next configs
      serverOptions: {
        dev: DEV,              // start with dev mode or not
        dir: '../webview',     // next.js app project dir
        conf: nextConfigs,     // imported next configs
      },
    }),
  ],
});