Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldoy/smor
Node static file web server with streaming support
https://github.com/eldoy/smor
Last synced: 6 days ago
JSON representation
Node static file web server with streaming support
- Host: GitHub
- URL: https://github.com/eldoy/smor
- Owner: eldoy
- Created: 2019-03-14T16:37:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-01T01:18:25.000Z (4 months ago)
- Last Synced: 2024-11-06T16:52:43.913Z (9 days ago)
- Language: JavaScript
- Homepage:
- Size: 30.2 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Smør
Node web static files server with built in compression support.
### Install
```
npm i smor
```### Usage
Vanilla NodeJS server. Will return 404 if not found, or the file using streams and correct mime type. Supports automatic 304 last modified headers.
```js
var http = require('http')
var smor = require('smor')var server = http.createServer((req, res) => {
// Using default options
smor(req, res)// With options, default values shown
smor(req, res, {
dir: '', // Start with '/' to use absolute path
maxAge: 3600,
indexFile: 'index.html',
compress: false
})
})server.listen(3000)
```MIT licensed. Enjoy!
Created by [Eldøy Projects](https://eldoy.com)