We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3f9bcd commit 846b37dCopy full SHA for 846b37d
1 file changed
servidor.js
@@ -0,0 +1,21 @@
1
+// servidor.js
2
+// Servidor básico em Node.js usando Express para servir arquivos estáticos (index.html, style.css, script.js)
3
+
4
+const express = require('express');
5
+const path = require('path');
6
7
+const app = express();
8
+const PORT = process.env.PORT || 3000;
9
10
+// Define a pasta de arquivos estáticos (onde estão index.html, style.css, script.js)
11
+app.use(express.static(path.join(__dirname, '.')));
12
13
+// Rota padrão para servir index.html
14
+app.get('/', (req, res) => {
15
+ res.sendFile(path.join(__dirname, 'index.html'));
16
+});
17
18
+// Inicia o servidor
19
+app.listen(PORT, () => {
20
+ console.log(`Servidor rodando em http://localhost:${PORT}`);
21
0 commit comments