-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
42 lines (36 loc) · 1.41 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var express = require("express");
var app = express();
app.set("view engine", "ejs");
var HLSServer = require("hls-server");
var hls = new HLSServer(app, {
provider: {
exists: function (req, callback) { // check if a file exists (always called before the below methods)
callback(null, true) // File exists and is ready to start streaming
callback(new Error("Server Error!")) // 500 error
callback(null, false) // 404 error
},
getManifestStream: function (req, callback) { // return the correct .m3u8 file
// "req" is the http request
// "callback" must be called with error-first arguments
callback(null, myNodeStream)
// or
callback(new Error("Server error!"), null)
},
getSegmentStream: function (req, callback) { // return the correct .ts file
callback(null, myNodeStream)
}
}
})
const searchCam = require("./routes/SearchCam");
const addCam = require("./routes/Camera");
app.use(express.urlencoded({ extended: true }))
app.use(express.json())
app.use("/SearchCam",searchCam);
app.use("/Camera",addCam);
app.use(express.static("hls"))
app.get('/', (req,res) => {
res.send("<a href='/Camera'>카메라관리</a><br><a href='/SearchCam'>카메라스캔</a>");
});
app.listen(8000, function(){
console.log("8000 port is listening!! ");
});