blob: 5d06222800f49a4c487f7b98e35a9929eb3de02c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import { embeddedTweet } from '../../src/api'
/**
* Return content for embedding
* @type {import('express').RequestParamHandler}
*/
const oembed = async (req, res) => {
let url = (req.query.url || '').toString()
return embeddedTweet(url).then(result => {
res.send(result)
res.end()
}).catch(err => {
console.log(`HTTP ${err.response ? err.response.status : err.code}: ${url}`)
res.sendStatus(err.response ? err.response.status : 500)
res.end()
})
}
export default oembed
|