Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serve

Package Overview
Dependencies
Maintainers
55
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serve - npm Package Compare versions

Comparing version 11.1.0 to 11.2.0

26

bin/serve.js

@@ -5,2 +5,3 @@ #!/usr/bin/env node

const http = require('http');
const https = require('https');
const path = require('path');

@@ -63,2 +64,3 @@ const fs = require('fs');

{bold $} {cyan serve} --version
{bold $} {cyan serve} folder_name
{bold $} {cyan serve} [-l {underline listen_uri} [-l ...]] [{underline directory}]

@@ -87,3 +89,3 @@

-n, --no-clipboard Do not copy the local address to the clipboard
-u, --no-compression Do not compress files

@@ -95,2 +97,6 @@

--ssl-cert Optional path to an SSL/TLS certificate to serve with HTTPS
--ssl-key Optional path to the SSL/TLS certificate\'s private key
{bold ENDPOINTS}

@@ -182,4 +188,5 @@

const compress = args['--no-compression'] !== true;
const httpMode = args['--ssl-cert'] && args['--ssl-key'] ? 'https' : 'http';
const server = http.createServer(async (request, response) => {
const serverHandler = async (request, response) => {
if (compress) {

@@ -190,4 +197,11 @@ await compressionHandler(request, response);

return handler(request, response, config);
});
};
const server = httpMode === 'https'
? https.createServer({
key: fs.readFileSync(args['--ssl-key']),
cert: fs.readFileSync(args['--ssl-cert'])
}, serverHandler)
: http.createServer(serverHandler);
server.on('error', (err) => {

@@ -216,4 +230,4 @@ if (err.code === 'EADDRINUSE' && endpoint.length === 1 && !isNaN(endpoint[0])) {

localAddress = `http://${address}:${details.port}`;
networkAddress = `http://${ip}:${details.port}`;
localAddress = `${httpMode}://${address}:${details.port}`;
networkAddress = `${httpMode}://${ip}:${details.port}`;
}

@@ -362,2 +376,4 @@

'--symlinks': Boolean,
'--ssl-cert': String,
'--ssl-key': String,
'-h': '--help',

@@ -364,0 +380,0 @@ '-v': '--version',

4

package.json
{
"name": "serve",
"version": "11.1.0",
"version": "11.2.0",
"description": "Static file serving and directory listing",

@@ -46,5 +46,5 @@ "scripts": {

"compression": "1.7.3",
"serve-handler": "6.1.0",
"serve-handler": "6.1.2",
"update-check": "1.5.2"
}
}

@@ -9,5 +9,5 @@ ![](https://assets.zeit.co/image/upload/v1527770721/repositories/serve/serve-repo-banner.png)

It behaves exactly like static deployments on [Now](https://zeit.co/now), so it's perfect for developing your static project. Then, when it's time to push it into production, you [deploy it](https://zeit.co/docs/examples/static).
Once it's time to push your site to production, we recommend using [ZEIT Now](https://zeit.co/now).
Furthermore, it provides a neat interface for listing the directory's contents:
In general, `serve` also provides a neat interface for listing the directory's contents:

@@ -26,3 +26,3 @@ ![screenshot](https://user-images.githubusercontent.com/6170607/40541195-167ff460-601b-11e8-8f66-3b0c7ff96cbb.png)

Once that's done, you can run this command inside your project's directory:
Once that's done, you can run this command inside your project's directory...

@@ -33,2 +33,8 @@ ```bash

...or specify which folder you want to serve:
```bash
serve folder_name
```
Finally, run this command to see a list of all available options:

@@ -35,0 +41,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc