mercredi 4 novembre 2020

Running Node.js Application with html server

i currently learn Node.js development and i try to start my Webcode. Im working with Visual Studio Code on Windows.

When i start the application with "npm start", the website on "localhost:3000/" just shows the "Server Connect". But how do i see all of the other files like the "Index.html"? Do i have to add them anywhere?

Thank you in advance.

Https Server File:

const http = require('http');

http.createServer(function(req, res){
    res.write('Server connect');
    res.end();
}).listen('3000');
package.json

{
  "name": "project-1",
  "version": "1.0.0",
  "description": "Project 1",
  "main": "index.html",
  "scripts": {
    "start": "nodemon server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "chartjs": "^0.3.24",
    "express": "^4.17.1",
    "http": "0.0.1-security",
    "mongodb": "^3.6.2",
    "mongoose": "^5.10.11",
    "nodemon": "^2.0.6"
  }
}



Aucun commentaire:

Enregistrer un commentaire