A simple 0 configuration command line http server-http-server (nodeJs)

Source: Internet
Author: User

Http-server is a simple 0 configuration command line HTTP server, based on NodeJs.

If you don't want to write NodeJs web-server.js repeatedly, you can use This.

installation (global Install plus-g):

used under Windows :

Open command line input in the site Directory

Http-server

  

Visit: http://localhost:8080 or http://127.0.0.1:8080

Used in Package.json

"scripts": {     "start": "http-server-a 0.0.0.0-p 8000",}

Parameters :

-p Port number (default 8080)-a IP address (default 0.0.0.0)-d display directory list (default ' true ')-i display AutoIndex (default ' true ')-e or--ext if no default file name extension (default ' HTML ') is provided -s or--silent Disable log information output--cors enable Cors via the Access-control-allow-origin header-o Open browser after starting service
-c sets the cache time (seconds) for the Cache-control max-age header, e.g.-c10 for the seconds (defaults to ' 3600 '). Disable caching, then use-c-1.
-u OR--UTC Format the log message using UTC time

-p Or--proxy Proxies all requests which can ' t is resolved locally to the given Url. E.g.:-p http://someurl.com

-s Or--ssl Enable HTTPS

-C or--cert SSL cert file path (default:cert.pem)

-k Or--key Path to SSL key file (default:key.pem).

-r or--robots provide a/robots.txt (whose content defaults to ' User-agent: *\ndisallow:/')

Reference document: a simple zero-configuration command-line HTTP server

A simple 0 configuration command line http server-http-server (nodeJs)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.