Skip to content

Commit 3fb7994

Browse files
author
Mudassir
committed
Initial commit
1 parent 0e1bc47 commit 3fb7994

File tree

8 files changed

+1096
-0
lines changed

8 files changed

+1096
-0
lines changed

Readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# opencv4nodejs-express-websockets
2+
3+
Boilerplate express app for getting started with opencv with nodejs and to live stream the video through websockets.
4+
5+
## Getting Started
6+
7+
```
8+
npm install
9+
npm start
10+
```
11+
If you are having any trouble in installing opencv4nodejs package, refer to [opencv4nodejs - nodejs bindings for opencv](https://github.com/justadudewhohacks/opencv4nodejs) for extensive guide for installation.
12+
13+
14+
## Built With
15+
16+
* [Express](https://expressjs.com/) - web framework for nodejs
17+
* [SocketIO](https://socket.io/) - websocket implmentation library for nodejs
18+
* [opencv4nodejs](https://github.com/justadudewhohacks/opencv4nodejs) - nodejs bindings for opencv 3

app.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const express = require('express');
2+
const http = require('http');
3+
const path = require('path');
4+
const cookieParser = require('cookie-parser');
5+
const streamEnabler = require('./stream');
6+
7+
const port = process.env.PORT || 3000
8+
9+
const indexRouter = require('./routes/index');
10+
11+
const app = express();
12+
const server = http.Server(app);
13+
const stream = streamEnabler(server);
14+
15+
app.use(express.json());
16+
app.use(express.urlencoded({ extended: false }));
17+
app.use(cookieParser());
18+
app.use(express.static(path.join(__dirname, 'public')));
19+
20+
app.use('/', indexRouter);
21+
22+
server.listen(port, () => {
23+
console.log('Listening on', port);
24+
});

0 commit comments

Comments
 (0)