import db from "../../lib/db"; import { withErrorHandling } from "../../lib/apiHelpers"; const handler = withErrorHandling(async (req, res) => { const { method } = req; switch (method) { case "GET": await get(req, res); default: res.setHeader("Allow", ["GET"]); res.status(405).end(`Method ${method} Not Allowed`); } }); const get = async (req, res) => { const params = { TableName: process.env.FMN_DYNAMODB_TABLENAME, KeyConditionExpression: "hk = :hk", ExpressionAttributeValues: { ":hk": "benramey@fastmail.com" }, }; let user = await db.query(params).promise(); res.status(200).json(user); }; export default handler;