Basic web page implementation

This commit is contained in:
ian ramzy 2020-03-22 13:36:29 -04:00
parent 341e386dd8
commit b884c60f95
3 changed files with 12 additions and 1 deletions

View File

@ -5,9 +5,19 @@ var express = require('express');
var app = express(); var app = express();
var http = require('http').createServer(app); var http = require('http').createServer(app);
var io = require('socket.io')(http); var io = require('socket.io')(http);
var path = require('path');
var public = path.join(__dirname, 'public');
app.use(express.static('public')); app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendFile(path.join(public, 'chat.html'));
});
app.get('/landing', function(req, res) {
res.sendFile(path.join(public, 'landing.html'));
});
function log(msg, room) { function log(msg, room) {
console.log(room + ": " + msg) console.log(room + ": " + msg)
} }
@ -71,3 +81,4 @@ io.on('connection', function (socket) {
http.listen(3000, function () { http.listen(3000, function () {
console.log("http://localhost:3000"); console.log("http://localhost:3000");
}); });

View File

@ -7,7 +7,7 @@
<body> <body>
<h1>Welcome to videochat</h1> <h1>Welcome to videochat</h1>
<h3>Click the button to get a disposable video chat room</h3> <h3>Click the button to get a disposable video chat room</h3>
<a href="index.html">Link</a> <a href="/">Link</a>
</body> </body>
</html> </html>