-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (23 loc) · 794 Bytes
/
index.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
const express = require('express')
var bodyParser = require('body-parser')
var upload = require('./uploader')
const app = express()
var multer = require('multer');
var multerupload = multer({ dest: 'temp-videos/' })
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
})
var router = express.Router();
router.get('/', function (req, res) {
res.send('Upload File API')
})
// manage video upload
router.post('/video/upload', multerupload.any(), upload.save)
app.use('/', router);
app.listen(3001, function () {
console.log('video-upload-service listing to 3001')
})