app moved to next.js

This commit is contained in:
tmshv committed 2019-08-01 14:44:25 +03:00
1 parent dcca513aea
commit 43af2996bf
48 files changed
+1147 -1027

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { dbUri } from '../../src/config'
import { connect } from '../../src/core/db'
import Image from '../../src/core/Image'
import ImageArtifactType from '../../src/core/ImageArtifactType'
export default async (req, res) => {
await connect(dbUri)
const file = req.query.file
const image = await Image.findByFile(file)
if (image) {
const data = image.getPicture(ImageArtifactType.LARGE)
res.json(data)
} else {
res.status(404)
res.json({
error: `Image ${file} not found`
})
}
}