chore: Add fetch_articles server route
This commit is contained in:
parent
4fb912cbf9
commit
bc0b59042e
16
src/routes/api/fetch_articles/+server.ts
Normal file
16
src/routes/api/fetch_articles/+server.ts
Normal 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));
|
||||
};
|
Loading…
Reference in New Issue
Block a user