Skip to content
Express wrapper containing webpack dev middleware and hot middleware
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.babelrc using babel to build Jun 27, 2016
.eslintrc first Sep 6, 2015
.gitignore no npm log Sep 6, 2015
.npmignore adding dummy .npmignore Jun 27, 2016
.travis.yml
README.md Update README.md May 25, 2016
package.json using babel to build Jun 27, 2016

README.md

Build Status npm version

##Express-Dev

An express wrapper which takes in a webpack config and returns you an express app with webpack dev middleware and webpack hot middleware in the stack.

expressDev = require 'express-dev'
config = require './config/webpack.dev.config'
app = expressDev(config)

You can add your own middlewares to this app instance just as you would with a standard express instance.

An example of it in usage within an app would look like this

JS Example

import path from 'path';
import { Router } from 'express';
import expressDev from 'express-dev';
import config from './config/webpack.dev.config';

const app = expressDev(config);
app.set('views', path.join(process.cwd(), 'src', 'views'));
app.set('view engine', 'jade');

const router = new Router();
router.get('/', (req, res, next) => res.render('index'));

app.use(router);
app.listen(3000, () => console.log('listening on port 3000'));

Coffeescript example

path = require 'path'
{Router} = require 'express' 
expressDev = require 'express-dev'
config = require './config/webpack.dev.config'

app = expressDev(config)
app.set 'views', path.join(process.cwd(), 'src', 'views')
app.set 'view engine', 'jade'

router = new Router()
router.get('/', (req, res, next) -> res.render 'index' )

app.use(router)
app.listen(3000, -> console.log 'listening on 3000')

Now you can dev your front end code with hot module reloading if it can do it, or live reloading if it cant.

You can’t perform that action at this time.