Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
grunt-nodestatic
Advanced tools
Start a node-static web server (perfect as a development server combined with watch or regarde).
Start a node-static web server (perfect as a development server combined with watch of regarde).
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-nodestatic --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-nodestatic');
Run this task with the grunt nodestatic
command.
Note that this server only runs as long as grunt is running. Once grunt's tasks have completed, the web server stops. This behavior can be changed with the keepalive option, and can be enabled ad-hoc by running the task like grunt nodestatic:keepalive
.
This task was designed to be used in conjunction with another task that is run immediately afterwards, like the grunt-contrib-watch plugin watch
task.
This plugin is perfect for development purpose combined with grunt watch.
Type: Integer
Default: 8080
The port on which the webserver will respond. The task will fail if the specified port is already in use. You can use the special values 0
or '?'
to use a system-assigned port.
Type: String
Default: '.'
The base (or root) directory from which files will be served. Defaults to the project Gruntfile's directory.
Type: Boolean
Default: false
Keep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will never run. By default, once grunt's tasks have completed, the web server stops. This option changes that behavior.
This option can also be enabled ad-hoc by running the task like grunt nodestatic:targetname:keepalive
Type: Boolean
Default: true
If true, specify additional headers (this one is useful for development): '{"Cache-Control": "no-cache, must-revalidate"}'
Type: Boolean
Default: false
If true, show each file requested on the server with differents colors following the status code
Type: Object
Default: {}
Sets response headers.
example: { 'X-Hello': 'World!' }
In this example, grunt nodestatic
(or more verbosely, grunt nodestatic:server
) will start a static web server at http://localhost:9001/
, with its base path set to the www-root
directory relative to the gruntfile, and any tasks run afterwards will be able to access it.
// Project configuration.
grunt.initConfig({
nodestatic: {
server: {
options: {
port: 8080,
base: 'www-root'
}
}
}
});
If you want your web server to use the default options, just omit the options
object. You still need to specify a target (uses_defaults
in this example), but the target's configuration object can otherwise be empty or nonexistent. In this example, grunt nodestatic
(or more verbosely, grunt nodestatic:uses_defaults
) will start a static web server using the default options.
// Project configuration.
grunt.initConfig({
nodestatic: {
uses_defaults: {}
}
});
You can specify multiple servers to be run alone or simultaneously by creating a target for each server. In this example, running either grunt nodestatic:site1
or grunt nodestatic:site2
will start the appropriate web server, but running grunt nodestatic
will run both. Note that any server for which the keepalive option is specified will prevent any task or target from running after it.
// Project configuration.
grunt.initConfig({
nodestatic: {
site1: {
options: {
port: 9000,
base: 'www-roots/site1'
}
},
site2: {
options: {
port: 9001,
base: 'www-roots/site2'
}
}
}
});
This project is a fork form the official grunt-contrib-connect.
This project use node-static as static web server.
Task submitted by "ia3andy" Andy Damevin
FAQs
Start a node-static web server (perfect as a development server combined with watch or regarde).
The npm package grunt-nodestatic receives a total of 2 weekly downloads. As such, grunt-nodestatic popularity was classified as not popular.
We found that grunt-nodestatic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.