Code: Select all
const express = require('express');
const app = express();
const port = 8080;
app.get('/', (req, res) => res.send('Hello World'));
app.listen(port);
console.log(`App running on http://localhost:${port}`);
< /code>
Ich habe auch die Datei der index.html im selben Ordner mit app.js. Hier gibt es eine HTML5 -Website. anstelle von Hello World?app.get('/',function(req,res) {
res.sendFile('index.html');
});