サムネイルを予め生成するように

This commit is contained in:
syuilo
2018-05-03 20:03:14 +09:00
parent 75764e59e1
commit 15e4cf1243
9 changed files with 182 additions and 107 deletions

View File

@@ -6,7 +6,6 @@ import * as fs from 'fs';
import * as Koa from 'koa';
import * as cors from '@koa/cors';
import * as Router from 'koa-router';
import pour from './pour';
import sendDriveFile from './send-drive-file';
// Init app
@@ -24,12 +23,14 @@ const router = new Router();
router.get('/default-avatar.jpg', ctx => {
const file = fs.createReadStream(`${__dirname}/assets/avatar.jpg`);
pour(file, 'image/jpeg', ctx);
ctx.set('Content-Type', 'image/jpeg');
ctx.body = file;
});
router.get('/app-default.jpg', ctx => {
const file = fs.createReadStream(`${__dirname}/assets/dummy.png`);
pour(file, 'image/png', ctx);
ctx.set('Content-Type', 'image/jpeg');
ctx.body = file;
});
router.get('/:id', sendDriveFile);