@nerjs/express

1.0.3 • Public • Published

express configs

Install

npm i @nerjs/exress

or:

yarn add @nerjs/express

Use

createApp

const createApp = require('@nerjs/express/app')

const app = createApp({/* ...appConfig */})

returns express app

appConfig:

prop name type default description
logger String | Function 'dev' settings for morgan
views String path to views dir. View engine: ejs
bodyJson Boolean true use body-parser method json()
bodyUrlcoded Boolean | Object true use body-parser method urlencoded()
cookies Boolean true use cookie-parser
favicon String path to faficon. Use serve-favicon
static String | [String] use express.static()

createHmrApp

Create Hot Module Replacement with express

returns express app

const createHmrApp = require('@nerjs/express/hmr')

create express app with HMR:

use default appConfig

const app = createHmrApp(pathToWebpackConfig)

add HMR to express app

const app = createHmrApp(app, pathToWebpackConfig)

create express app with config and HMR

accepts a appConfig as the first argument

const app = createHmrApp(appConfig, pathToWebpackConfig)

isExpressApp

const isExpressApp = require('@nerjs/express/lib/isExpressApp')
const express = require('express')

const app = express()


isExpressApp(app) == true
isExpressApp({}) == false

🔗 All utils

Readme

Keywords

Package Sidebar

Install

npm i @nerjs/express

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

7.48 kB

Total Files

8

Last publish

Collaborators

  • nerjs