Readme

This is a simple script to create a post on Campsite. Use it as a starting point for other scripts.

Campsite API Documentation: https://campsite.com/docs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Hello World
*
* This is a simple script to create a post on Campsite. Use it as a starting point for other scripts.
*
* Campsite API Documentation: https://campsite.com/docs
*/
const CONTENT = `Hello world`;
const PROJECT_ID = "<project_id>";
async function main() {
const body = {
title: "Hello World",
content_markdown: CONTENT,
project_id: PROJECT_ID,
};
const response = await fetch("https://api.campsite.com/v2/posts", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Deno.env.get("CAMPBOT_API_KEY")}`,
},
body: JSON.stringify(body),
});
console.log(await response.json());
}
main();
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
September 6, 2024