chore: Add fetch_articles server route

This commit is contained in:
Keisuke Hirata 2024-09-02 22:02:30 +09:00
parent 4fb912cbf9
commit bc0b59042e

View File

@ -0,0 +1,16 @@
import { json } from '@sveltejs/kit';
import { error } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import {
TOKEN
} from '$env/static/private'
export const POST: RequestHandler = ({ url }) => {
const token = url.searchParams.get('token');
console.log(token);
if (token !== TOKEN) {
return error(401, 'Unauthorized');
}
return new Response(String(token));
};