mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-13 03:50:02 -04:00
add authentication
This commit is contained in:
parent
948611f434
commit
e78eb63e4e
4 changed files with 50 additions and 15 deletions
|
@ -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,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue