🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

goat

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goat

Serve static files for development, simple and unobstructive.

Source
npmnpm
Version
0.4.2
Version published
Weekly downloads
74
23.33%
Maintainers
1
Weekly downloads
 
Created
Source

goat

Serve static files for development, simple and unobstructive.

NPM

Usage

npm install -g goat

Then add it to your package.json as a script (you can also install without the -g for a single project):

{
  "name": "my-project",
  "scripts": {
    "serve": "goat -e ./static/index.html ./dist"
  }
}

Which can now be executed in the terminal with npm run serve.

Available Options

Usage: goat [options]

Options:

  -h, --help                output usage information
  -V, --version             output the version number
  -e, --entry-file [file]   Usually an index.html, defaults to './index.html'
  -p, --port [port]         Port to run server on, defaults to 3000
  -d, --domain-host [host]  Host to serve static files at, defaults to 'localhost'
  -x, --debug               Enable development logging for debugging purposes

Multiple Static Directories

Any additional paths that you append to the end will be served as static directories. When using -e, the parent directory is added as a static directory, so no need to add it manually.

Custom Named Routes

For custom named routes, use the : (colon) syntax. For example:

goat -e ./static/index.html ./dist/scripts:/scripts

Would make everything in the scripts folder available at localhost:3000/scripts.

Multiple formats are supported:

  • .js -- If you specify a .js file with a named route, it's assumed to be an express route, e.g. api/users.json:/api/users. See the example route in test/route.js which can be ran with goat -e test/index.html test/route.js:/api/hello
  • .json -- Is JSON, so we serve it as JSON, also only if there is an custom named route. This is an easy way to mock an API endpoint.

FAQs

Package last updated on 09 Jan 2015

Did you know?

Socket

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.

Install

Related posts