repl.it
@Vandesm14/

captioning

Express

No description

fork
loading
Files
  • index.js
  • Packager files
  • package-lock.json
  • package.json
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
31
const express = require('express');
const bodyParser = require('body-parser');

const app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.use(express.static('public'));

let captions = [];

app.get('/', (req, res) => {
  res.send('success');
});

app.post('/api', (req, res) => {
	console.log(req.body);
	let transcript = req.body.transcript;
	let sequence = req.body.sequence;

	captions[sequence] = transcript;
	console.clear();
	console.log(captions.join(' '));

	res.header("Access-Control-Allow-Origin", "*");
  res.status(200).send('success');
});

app.listen(3000, () => console.log('server started'));
Fetching token
?