-
Notifications
You must be signed in to change notification settings - Fork 8
/
server.js
45 lines (35 loc) · 1 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
43
44
45
const express = require('express');
const path = require('path');
const youtubeService = require('./youtubeService.js');
const server = express();
server.get('/', (req, res) =>
res.sendFile(path.join(__dirname + '/index.html'))
);
server.get('/authorize', (request, response) => {
console.log('/auth');
youtubeService.getCode(response);
});
server.get('/callback', (req, response) => {
const { code } = req.query;
youtubeService.getTokensWithCode(code);
response.redirect('/');
});
server.get('/find-active-chat', (req, res) => {
youtubeService.findActiveChat();
res.redirect('/');
});
server.get('/start-tracking-chat', (req, res) => {
youtubeService.startTrackingChat();
res.redirect('/');
});
server.get('/stop-tracking-chat', (req, res) => {
youtubeService.stopTrackingChat();
res.redirect('/');
});
server.get('/insert-message', (req, res) => {
youtubeService.insertMessage('Hello World');
res.redirect('/');
});
server.listen(3000, function() {
console.log('Server is Ready');
});