Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/json2d/bunk
a decidedly featureless, low dependency http server to serve static resource files, with cli support
https://github.com/json2d/bunk
Last synced: about 1 month ago
JSON representation
a decidedly featureless, low dependency http server to serve static resource files, with cli support
- Host: GitHub
- URL: https://github.com/json2d/bunk
- Owner: json2d
- Created: 2017-03-28T15:23:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-11T20:12:00.000Z (almost 8 years ago)
- Last Synced: 2024-11-19T22:13:32.427Z (2 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bunk
a decidedly featureless, low dependency http server to serve static resource files, with cli support
### Getting Started
Install it globally for use on the command line.
```
$ npm install -g bunk
```### CLI Usage
The most basic way to use `bunk` is to run on the terminal:
```
$ bunk
```
This will serve all static files within the current working directory at [localhost:7070](localhost:7070).### Options
For more _"advanced"_ usage, include in the command:
```
-d, --dir directory of static files to serve, default: .
-p, --port port to run http server on, default: 7070
```For exmaple, to serve the directory `build/production` on port `1337`, run on the terminal:
```
$ bunk -d build/production -p 1337
```It is recommended, but not required, that you have an `index.html` within the root of the directory being served.
### API Usage
Install it as a local dependency for use within another module.
```
$ npm install --save bunk
$ npm install --save-dev bunk
```Then require and call `bunk` with or without options
```javascript
var bunk = require('bunk');bunk()
// => bunk: serving . on port 7070bunk({dir:'build/production', port:1337})
// => bunk: serving build/production on port: 1337
```### Credits
This module was heavily inspired by an example usage of [serve-static](https://github.com/expressjs/serve-static).