But there's no real Ruby on Rails in js land
But there's no real Ruby on Rails in js land

import {v2 as cloudinary} from "Cloudinary"
import fs from "fs"
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
});
const uploadOnCloudinary = async (localFilePath) => {
try {
if (!localFilePath) return null
//upload the file onCloudinaryy
const response = await cloudinary.uploader.upload(localFilePath, {
resource_type: "auto"
})
// file has been uploadedsuccessfull
//console.log("file is uploaded onCloudinaryy ", response.url);
fs.unlinkSync(localFilePath)
return response;
} catch (error) {
fs.unlinkSync(localFilePath) // remove the locally saved temporary file as the upload operation got failed
return null;
}
}
export {uploadOnCloudinary}// code
const body = await ctx.req.parseBody()
console.log(body["image"]);
// output
image: File {
lastModified: 1712061871701,
name: 'm5.jpg',
type: 'image/jpeg',
size: 84673
}
npm i itty-durable. There are 3 other projects in the npm registry using itty-durable.
itty-router v3 in there... just a heads up, we've just released v5 - that should bring you a bunch of improvements over the legacy v3: https://itty.dev/itty-router/migrations/v4-v5cache.put's?Date.now() doesn't work?Date.now()fetch('1.1.1.1')? gives me Fetch API cannot load: 1.1.1.1await fetch('https://cloudflare.com', {method: 'HEAD'}) "outcome": "exception",
"scriptName": "mage-api",
"diagnosticsChannelEvents": [],
"exceptions": [
{
"name": "Error",
"message": "The script will never generate a response.",
"timestamp": 1712091400239
}
],

/cdn-cgi/trace path of your website, ex: https://d1-a-ut.makemyparty.live/cdn-cgi/trace, and look at colo={airportcode}, and that airport code is the identifider of the location you hitimport {v2 as cloudinary} from "Cloudinary"
import fs from "fs"
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
});
const uploadOnCloudinary = async (localFilePath) => {
try {
if (!localFilePath) return null
//upload the file onCloudinaryy
const response = await cloudinary.uploader.upload(localFilePath, {
resource_type: "auto"
})
// file has been uploadedsuccessfull
//console.log("file is uploaded onCloudinaryy ", response.url);
fs.unlinkSync(localFilePath)
return response;
} catch (error) {
fs.unlinkSync(localFilePath) // remove the locally saved temporary file as the upload operation got failed
return null;
}
}
export {uploadOnCloudinary}// code
const body = await ctx.req.parseBody()
console.log(body["image"]);
// output
image: File {
lastModified: 1712061871701,
name: 'm5.jpg',
type: 'image/jpeg',
size: 84673
} "outcome": "exception",
"scriptName": "mage-api",
"diagnosticsChannelEvents": [],
"exceptions": [
{
"name": "Error",
"message": "The script will never generate a response.",
"timestamp": 1712091400239
}
],