node. JS installation uses Http-server

Source: Internet
Author: User

How do I use node. js NPM after it has been installed http-server globally? I created the inde.html in its installation directory, the browser localhost:8080 can access, then my project needs to be placed in its installation directory? Or do I need to configure something under my project or use a command to start it? I open cmd in my project directory run Http-server prompt error, trouble will friends tell me how to use Http-server.

1. First make sure it is a global installation

npm install http-server -g

2. For example, one of my directory structures



3. Enter the catalogue knocking command



4. Browser access

例如http://localhost:8081/index.html或http://localhost:8081/app.js

The react directory here becomes the root directory of the server.

node. JS installation uses Http-server

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.