-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
22 lines (18 loc) · 837 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const express = require("express");
const app = express();
const http = require("http"); // Used to start server
const server = http.createServer(app);
// Send HTML file when user connects to server
const path = require("path"); // Import the "path" module.
app.use(express.static(path.join(__dirname, "website"))); //serve static files from the "website" directory.
// Serve Three.js library from node_modules
app.use('/three', express.static(path.join(__dirname, 'node_modules', 'three', 'build')));
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "website/index.html"));
});
// Start server on port
const localIPAddress = "localhost" // ipv4 //"10.104.58.91" // IPv4 or localhost
const port = 3000
server.listen(port, localIPAddress, () => {
console.log(`Server is running on http://${localIPAddress}:${port}`)
})