add authentication

This commit is contained in:
rift 2024-08-20 23:42:02 -05:00
parent 948611f434
commit e78eb63e4e
4 changed files with 50 additions and 15 deletions

View file

@ -1,10 +1,19 @@
// This is a test file to upload files to the Nebula server
import { FormData, File } from "formdata-node";
import { fileFromPath } from "formdata-node/file-from-path";
import config from "./config.json" assert { type: "json" };
const form = new FormData();
// const file = new File(["My hovercraft is full of eels"], "example.txt");
form.set("file", await fileFromPath("asgard.png"));
await fetch("http://localhost:8080/upload", { method: "post", body: form });
console.log(config.marketplace_psk);
await fetch("http://localhost:8080/api/upload-image", {
headers: {
PSK: config.marketplace_psk,
},
method: "post",
body: form,
});