How to run html file using node js

前端 未结 8 865
南笙
南笙 2021-01-30 11:04

I have a simple html page with angular js as follows:

    //Application name
    var app = angular.module(\"myTmoApppdl\", []);

    app.controller(\"myCtrl\", f         


        
8条回答
  •  深忆病人
    2021-01-30 11:24

    Move your HTML file in a folder "www". Create a file "server.js" with code :

    var express = require('express');
    var app = express();
    
    app.use(express.static(__dirname + '/www'));
    
    app.listen('3000');
    console.log('working on 3000');
    

    After creation of file, run the command "node server.js"

提交回复
热议问题