article update automation #4
|
@ -6,11 +6,18 @@ import {
|
||||||
TOKEN
|
TOKEN
|
||||||
} from '$env/static/private'
|
} from '$env/static/private'
|
||||||
|
|
||||||
export const POST: RequestHandler = ({ url }) => {
|
import PG from '$lib/server/database';
|
||||||
|
import { getConnection } from '$lib/server/database/get_connection';
|
||||||
|
// import { building } from '$app/environment';
|
||||||
|
import init from '$lib/server/database/init_db';
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ url }) => {
|
||||||
const token = url.searchParams.get('token');
|
const token = url.searchParams.get('token');
|
||||||
console.log(token);
|
console.log(token);
|
||||||
if (token !== TOKEN) {
|
if (token !== TOKEN) {
|
||||||
return error(401, 'Unauthorized');
|
return error(401, 'Unauthorized');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await init(await PG(getConnection()));
|
||||||
return new Response(String(token));
|
return new Response(String(token));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user