1.1.2 • Published 6 years ago

goat v1.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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
  -c, --cors                Enable cors

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.
  • .html -- Sends the html.
1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

8 years ago

0.5.0

8 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago