-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
45 lines (34 loc) · 1.16 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
require("dotenv").config()
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const AWS = require('aws-sdk');
const fs = require('fs');
const StreamBuilder = require("./services/Streaming/StreamBuilder")
const port = process.env.PORT || 3000;
AWS.config.update({
region: 'ap-southeast-2',
accessKeyId: process.env.AWS_LIVESTREAM_SDK_ACCESS_KEY,
secretAccessKey: process.env.AWS_LIVESTREAM_SDK_SECRET_ACCESS_KEY
});
AWS.config.apiVersions = {
medialive: '2017-10-14',
mediapackage: '2017-10-12',
cloudfront: '2019-03-26',
ssm: '2014-11-06',
// other service API versions
};
const awsDependencies = {
mediaLive: new AWS.MediaLive(),
mediaPackage: new AWS.MediaPackage(),
cloudfront: new AWS.CloudFront(),
ssm: new AWS.SSM()
}
//set dependencies
StreamBuilder.dependencies.AWS = awsDependencies
app.use(bodyParser.json({ verify: function (req, res, buf) { req.rawBody = buf } }))
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
require('./routes/streaming')(app);
app.listen(port, () => console.log(`API listening on port ${port}`));