refactor: refactoring imports
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
This commit is contained in:
parent
31e3aaeda0
commit
b9cb6d1c10
663 changed files with 3194 additions and 3134 deletions
|
|
@ -3,10 +3,16 @@
|
|||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import * as Koa from 'koa';
|
||||
import * as cors from '@koa/cors';
|
||||
import * as Router from '@koa/router';
|
||||
import sendDriveFile from './send-drive-file';
|
||||
import sendDriveFile from './send-drive-file.js';
|
||||
|
||||
//const _filename = fileURLToPath(import.meta.url);
|
||||
const _filename = __filename;
|
||||
const _dirname = dirname(_filename);
|
||||
|
||||
// Init app
|
||||
const app = new Koa();
|
||||
|
|
@ -16,7 +22,7 @@ app.use(cors());
|
|||
const router = new Router();
|
||||
|
||||
router.get('/app-default.jpg', ctx => {
|
||||
const file = fs.createReadStream(`${__dirname}/assets/dummy.png`);
|
||||
const file = fs.createReadStream(`${_dirname}/assets/dummy.png`);
|
||||
ctx.body = file;
|
||||
ctx.set('Content-Type', 'image/jpeg');
|
||||
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue