Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including express-dev with all npm packages installed. Try it out:

var expressDev = require("express-dev")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

express-dev v1.2.0

express wrapper containing webpack dev middleware and hot middleware

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.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free