Skip to content

Commit

Permalink
added html file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohit5Upadhyay committed Aug 25, 2024
1 parent 98f754f commit 0f625b7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ const socketio = require("socket.io");
const server = http.createServer(app);
const io = socketio(server);

app.set("view engine", "ejs");
// app.set("view engine", "ejs");
// app.set('views', path.join(__dirname, 'views'));

app.use(cors());
app.use(express.static(path.join(__dirname, "public")));

// app.get('/', (req, res) => {
// res.sendFile(path.join(__dirname, 'views', 'index.html'));
// });

io.on("connection", function (socket) {
socket.on("send-location", function (data) {
io.emit("receive-location", { id: socket.id, ...data });
Expand All @@ -26,7 +30,8 @@ io.on("connection", function (socket) {
});

app.get("/", function (req, res) {
res.render("index");
// res.render("index");
res.sendFile(path.join(__dirname, 'views', 'index.html'));
});

const PORT = process.env.PORT || 3000;
Expand Down
File renamed without changes.
33 changes: 33 additions & 0 deletions views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Real Time Tracking Application</title>

<!-- Local CSS -->
<link rel="stylesheet" href="/css/style.css">

<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css">
<!-- You can also use the following CDN as an alternative to the above -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css" integrity="sha512-Zcn6bjR/8RZbLEpLIeOwNtzREBAJnUKESxces60Mpoj+2okopSAcSUIUOseddDm0cxnGQzxIR7vJgsLZbdLE3w==" crossorigin="anonymous" referrerpolicy="no-referrer" /> -->
</head>
<body>
<!-- Map Container -->
<div id="map"></div>

<!-- Leaflet JavaScript -->
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<!-- You can also use the following CDN as an alternative to the above -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.js" integrity="sha512-puJW3E/qXDqYp9IfhAI54BJEaWIfloJ7JWs7OeD5i6ruC9JZL1gERT1wjtwXFlh7CjE7ZJ+/vcRZRkIYIb6p4g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->

<!-- Socket.IO JavaScript -->
<script src="/socket.io/socket.io.js"></script>
<!-- You can also use the following CDN as an alternative to the above -->
<!-- <script src="https://cdn.socket.io/4.7.5/socket.io.min.js" integrity="sha384-2huaZvOR9iDzHqslqwpR87isEmrfxqyWOF7hr7BY6KG0+hVKLoEXMPUJw3ynWuhO" crossorigin="anonymous"></script> -->

<!-- Local JavaScript -->
<script src="js/script.js"></script>
</body>
</html>

0 comments on commit 0f625b7

Please sign in to comment.