https://github.com/doodzik/serve-dir
serve a directory
https://github.com/doodzik/serve-dir
static-file-server
Last synced: over 1 year ago
JSON representation
serve a directory
- Host: GitHub
- URL: https://github.com/doodzik/serve-dir
- Owner: doodzik
- License: mit
- Created: 2017-10-30T22:16:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T07:58:45.000Z (over 8 years ago)
- Last Synced: 2025-02-03T14:31:59.270Z (over 1 year ago)
- Topics: static-file-server
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serve-dir
Serve a directory as a website.
# Installation
```
$ npm install doodzik/serve-dir
```
If you want to use the command line command `serve-dir` install this module globally
```
$ npm install -g doodzik/serve-dir
```
# Usage
```
const Server = require('serve-dir')
const dir = __dirname
const server = new Server({dir})
server.listen().then(port => {
console.log(`serving dir at: http://${server.host}:${port}/`)
}).then(() => server.destroy())
```
```
# Or in the CLI
# serve current dir
$ serve-dir
# serve a dir
$ serve-dir ./path/to/dir
```
# API
# Author
[Frederik Dudzik](https://dudzik.co)