Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

пример кода сервера express js отдающего статические файлы

  1. User

    пример кода сервера express js отдающего статические файлы

  2. Assistant

    const express = require('express'); const app = express();

    app.use(express.static('public'));

    app.listen(3000, () => { console.log('Server is listening on port 3000'); });

    // public is the directory that contains your static files such as HTML, CSS, and JavaScript files. // The server will serve these files when we access them using the URL. For example, if there is a file // called index.html in the public directory, we can access it using the URL http://localhost:3000/index.html.