Skip to content

Commit

Permalink
Refactor RSS route to use getQuery for format handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabinatix97 committed Dec 20, 2024
1 parent ca05f3b commit e803c1a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/routes/rss.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { defineEventHandler } from 'h3';
import { defineEventHandler, getQuery, send } from 'h3';
import { promises as fs } from 'fs';
import path from 'path';
import { Feed } from 'feed';
import path from 'path';
import matter from 'gray-matter';
import { send } from 'h3';

export default defineEventHandler(async (event) => {
const contentDir = path.resolve('content/blog');
Expand Down Expand Up @@ -59,8 +58,10 @@ export default defineEventHandler(async (event) => {
image: `https://www.fabi-online.de/${post.img}`
});
}

const query = getQuery(event);
const format = query.format || 'rss';

const format = event.context.query.format || 'rss';
let content: string;
let contentType: string;

Expand Down

0 comments on commit e803c1a

Please sign in to comment.