Answer the question
In order to leave comments, you need to log in
Where to write code in nodejs server next?
I have created a nodejs server. Where to write js code next?
I have app.js:
// Подключение всех модулей к программе
const fs = require("fs");
const express = require("express");
const app = express();
const server = require("http").createServer(app);
// Отслеживание порта
server.listen(3000);
// Отслеживание url адреса и отображение нужной HTML страницы
app.get("/", function(req, res) {
res.sendFile(__dirname + "/index.html");
});
const fileOutput = document.querySelector("#fileOutput");
fs.readFile("index.txt", "utf-8", function(err, data) {
if (err) throw err;
let fileData = data;
fileOutput.innerText = fileOutput;
});
document is not defined
on the command line. require is not defined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question