reformat with prettier

This commit is contained in:
Michael Zhang 2022-11-06 19:33:24 -06:00
parent b14a49803e
commit 655085cb6d
3 changed files with 16 additions and 18 deletions

View file

@ -35,7 +35,6 @@ export default function Layout({ children }: Props) {
[license]
</a>
&middot;
{/* eslint-disable @next/next/no-img-element */}
<a href="https://github.com/iptq/wisesplit/stargazers">
<img

View file

@ -1,14 +1,14 @@
import { Db, MongoClient } from 'mongodb';
import { Db, MongoClient } from "mongodb";
const USERNAME = process.env.MONGO_USERNAME
const PASSWORD = process.env.MONGO_PASSWORD
const HOSTNAME = process.env.MONGO_HOSTNAME
const DATABASE_NAME = process.env.MONGO_DATABASE_NAME
const DATABASE_PORT = process.env.MONGO_DATABASE_PORT
const URI =
`mongodb://${USERNAME}:${PASSWORD}@${HOSTNAME ?? 'localhost'}:${DATABASE_PORT}`;
const USERNAME = process.env.MONGO_USERNAME;
const PASSWORD = process.env.MONGO_PASSWORD;
const HOSTNAME = process.env.MONGO_HOSTNAME;
const DATABASE_NAME = process.env.MONGO_DATABASE_NAME;
const DATABASE_PORT = process.env.MONGO_DATABASE_PORT;
const URI = `mongodb://${USERNAME}:${PASSWORD}@${
HOSTNAME ?? "localhost"
}:${DATABASE_PORT}`;
let db: Db | null = null;
@ -22,4 +22,4 @@ export const getMongoDBClient = async () => {
db = client.db(DATABASE_NAME);
return db;
}
};

View file

@ -1,13 +1,12 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import { getMongoDBClient } from '../../lib/getMongoDBClient';
import type { NextApiRequest, NextApiResponse } from "next";
import { getMongoDBClient } from "../../lib/getMongoDBClient";
export default async function handler(
req: NextApiRequest,
res: NextApiResponse<Record<string, string>[] | Record<string, string>>
) {
if (req.method !== 'POST') {
return res.status(405).json({message: 'Only POST method allowed'});
if (req.method !== "POST") {
return res.status(405).json({ message: "Only POST method allowed" });
}
const receipt = req.body;
const client = await getMongoDBClient();