pterodactyl-manager
Version:
A powerful and easy-to-use API wrapper for Pterodactyl's API, providing a seamless integration of server management and user administration functionalities.
15 lines (13 loc) • 459 B
JavaScript
const getUser = require("../Users/getUser");
module.exports = async function createServer(url, headers, query, server) {
try {
const response = await fetch(`${url}/api/application/servers`, {
method: "POST",
headers,
body: JSON.stringify({...server, user: (await getUser(url, headers, query)).attributes.id})
});
return JSON.parse(await response.text());
} catch (err) {
console.log(err);
}
};