Comparing version 7.1.0 to 7.1.1
{ | ||
"name": "serve", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"description": "Static file serving and directory listing", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -42,4 +42,21 @@ # serve | ||
The core of `serve` is [serve-handler](https://github.com/zeit/serve-handler), which can be used as middleware in existing HTTP servers. | ||
The core of `serve` is [serve-handler](https://github.com/zeit/serve-handler), which can be used as middleware in existing HTTP servers: | ||
```js | ||
const handler = require('serve-handler'); | ||
const http = require('http'); | ||
const server = http.createServer((request, response) => { | ||
// You pass two more arguments for config and middleware | ||
// More details here: https://github.com/zeit/serve-handler#options | ||
return handler(request, response); | ||
}) | ||
server.listen(3000, () => { | ||
console.log('Listening on http://localhost:3000'); | ||
}); | ||
``` | ||
**NOTE:** You can also replace `http.createServer` with [micro](https://github.com/zeit/micro), if you want. | ||
## Contributing | ||
@@ -46,0 +63,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12590
76