awesome-live-server
Version:
a simple static server
50 lines (47 loc) • 1.53 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
ul,
li {
list-style: none;
}
</style>
</head>
<body>
<ul>
<% fileList.forEach((item) => {%>
<li>
<% if(item.type === 'dir') {%>
<span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span><a href="<%=item.link%>">
<%=item.name%></a>
<% } %>
<% if(item.type !== 'dir') {%>
<span class="glyphicon glyphicon-file" aria-hidden="true"></span><a href="<%=item.link%>">
<%=item.name%></a>
<% } %>
</li>
<% }) %>
</ul>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io('http://localhost:4444');
socket.on('connect', function () {
console.log('connected');
});
socket.on('message',function(msg){
if(msg === 'refresh') {
setTimeout(function() {
window.location.reload();
}, 1000);
}
})
</script>
</body>
</html>