-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ac0259
commit 2d80908
Showing
56 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { NextApiRequest, NextApiResponse } from "next"; | ||
import { findLawProblemById } from "../../../../server/mongodb/actions/lawProblem"; | ||
import requestWrapper from "../../../../server/utils/middleware"; | ||
|
||
async function handler(req: NextApiRequest, res: NextApiResponse) { | ||
if (req.method !== "GET") { | ||
res.status(405).end(); | ||
return; | ||
} | ||
const { id } = req.query; | ||
const problem = await findLawProblemById(id); | ||
|
||
const formattedResponse = JSON.stringify(problem, null, 2); | ||
|
||
res.setHeader("Content-Type", "application/json"); | ||
res.status(200).send(formattedResponse); | ||
} | ||
|
||
export default requestWrapper(handler, "GET"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { NextApiRequest, NextApiResponse } from "next"; | ||
import { getAllLawProblems } from "../../../../server/mongodb/actions/lawProblem"; | ||
import requestWrapper from "../../../../server/utils/middleware"; | ||
|
||
async function handler(req: NextApiRequest, res: NextApiResponse) { | ||
const allProblems = await getAllLawProblems(); | ||
|
||
const formattedResponse = JSON.stringify(allProblems, null, 2); | ||
|
||
res.setHeader("Content-Type", "application/json"); | ||
res.status(200).send(formattedResponse); | ||
} | ||
|
||
export default requestWrapper(handler, "GET"); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.