import type { RequestEvent, RequestHandler } from './$types'
import {json} from '@sveltejs/kit'
import { createUser, getUsers } from '$lib/data/users'

//api/users 
export const POST: RequestHandler = async ({ request }: RequestEvent) => {
    const data = await request.json()
    return json(await createUser( data))
}
export const GET: RequestHandler = async () => {
    return json(await getUsers())
}