Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
simple-dev-server
Advanced tools
A webpack optional dev server with proxies and mocking that requires almost no configuration.
This is a simple dev server that works with webpack apps or without webpack. It is meant to make development easier and aims to end the prickly practice of running two servers in development.
devserver.config.js
.module.exports = {
proxy: {
'/api/*': 'http://url.of.prod.api/'
},
publicPaths: {
'/assets': 'assets'
},
mockPath: 'mock',
app: '/index.html', // this can also be an express app
port: 5450, // 3000 by default
};
All options are optional.
If you'd like to start more than one server with the same build, useful when making multiple apps, use an array of config objects instead of a single one.
proxy
- key/value pairs of URLs to servers to proxy requests. This allows you to work with an external API and/or image server.publicPaths
- a key/value pair of URLs to the static file directories in which they are contained.mockPath
- You can make a folder on your project that contains sample responses from your API calls. Paths that exist in this directory structure will be used instead of making HTTP calls.app
- either an express app (such as your production app) or a file path to the index of a single page app.port
- the port number that will be used.The recommended way is to install it as a devDependency to your project, then save it as your npm start
or npm run dev
script.
npm install --save-dev simple-dev-server
Then add this to your package.json:
{
"name": "YourApp",
"scripts": {
"start": "./node_modules/.bin/simple-dev-server"
}
}
npm install -g simple-dev-server
Then you may simply run simple-dev-server
// Nothing. It'll run on port 3000
module.exports = {
proxy: {
'/api/*': 'http://url.of.prod/',
'/usercontent/*': 'http://url.of.prod/'
},
publicPaths: {
'/assets': 'assets'
}
};
module.exports = {
proxy: {
'/api/*': 'http://url.of.prod.api/',
},
app: '/index.html'
};
You can have webpack serve index.html using the webpack-html-plugin
, if it doesn't exist in the build it will be served statically.
FAQs
A webpack optional dev server with proxies and mocking that requires almost no configuration.
The npm package simple-dev-server receives a total of 47 weekly downloads. As such, simple-dev-server popularity was classified as not popular.
We found that simple-dev-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.