feat: add vercel entrance

This commit is contained in:
DIYgod 2024-03-01 02:11:15 +08:00
parent b2aa636886
commit 9169e5fe9b
No known key found for this signature in database
3 changed files with 12 additions and 15 deletions

View File

@ -1,14 +0,0 @@
const path = require('path');
const moduleAlias = require('module-alias');
moduleAlias.addAlias('@', path.join(__dirname, '../lib'));
const config = require('../lib/config');
config.set({
NO_LOGFILES: true,
});
const app = require('../lib/app');
module.exports = (req, res) => {
app.callback()(req, res);
};

11
lib/vercel.ts Normal file
View File

@ -0,0 +1,11 @@
import { handle } from 'hono/vercel';
import app from '@/app';
import logger from '@/utils/logger';
export const runtime = 'edge';
logger.info(`🎉 RSSHub is running! Cheers!`);
logger.info('💖 Can you help keep this open source project alive? Please sponsor 👉 https://docs.rsshub.app/support');
export const GET = handle(app);
export const POST = handle(app);

View File

@ -1,5 +1,5 @@
{
"framework": null,
"github": { "silent": true },
"routes": [{ "src": "/.*", "dest": "/api/vercel.js" }]
"routes": [{ "src": "/.*", "dest": "/lib/vercel.ts" }]
}