const express = require("express");
const jimp = require("jimp");
const path = require("path");
const url = require("url");
app.use(express.static("public"));
app.post("/publish/resources/upload", async (request, response) => {
const [asset] = request.body.assets;
const image = await jimp.read(asset.url);
// Write the file to disk
const filePath = path.join(__dirname, "public", asset.name);
await image.writeAsync(filePath);
// Respond to the request
protocol: request.protocol,
host: request.get("host"),
app.listen(process.env.PORT || 3000);