-
Notifications
You must be signed in to change notification settings - Fork 0
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
b77382b
commit aa434dd
Showing
3 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import { writeFile } from "fs/promises"; | ||
import type { RequestHandler } from "./$types"; | ||
import { writePage } from "$lib/page"; | ||
|
||
export const PUT: RequestHandler = async ({ request, params }) => { | ||
// write fileContents from request to a file with the name fileName from request | ||
const { fileContents } = await request.json(); | ||
await writeFile(`pages/${params.page}.md`, fileContents, "utf-8"); | ||
await writePage(params.page, { content: fileContents }); | ||
return new Response(null, { status: 204 }); | ||
}; |
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