Skip to content

Starts backends, apis, and other servers alongside webpack-dev-server

Notifications You must be signed in to change notification settings

antony/webpack-backend-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack backend plugin

A webpack plugin for bootstrapping your backend (an API, server, whatever)

Very simplistic, simply runs a method in another javascript file, defined by you:

// server.js

const http = require('http')  
const port = 3000

const server = http.createServer((request, response) => {  
  response.end('Hello Node.js Server!')
})

exports.start = function () {
  server.listen(port)
}

Then you could use this configuration.

// webpack.config.js

plugins: [
  new WebpackBackendPlugin({
    backend: require('./server'), // your backend 
    entrypoint: 'start' // name of the bootstrap method
  })
]

now, when webpack starts, so does your backend - and you can proxy requests to it!

About

Starts backends, apis, and other servers alongside webpack-dev-server

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published