Where are my PDFs
Hi everyone I need help.
1.- My app is working but I don't know where I can find these files I'm saving them in /uploads/pdfs but I don't know how I can do to see them all.
export const crearPDFURL = async (req, res) => {
console.log("Entro aquí");
try {
const { id } = req.params;
const usuarioExiste = await prisma.usuario.findUnique({
where: {
id: parseInt(id),
},
});
if (!usuarioExiste) {
return res.status(400).json({ msg: "No existe el usuario" });
}
const fecha_pago = new Date();
const fechaPagoFormateada =
${fecha_pago.getDate() - 1}/${fecha_pago.getMonth() + 1}/${fecha_pago.getFullYear()}
;
// Obtén el nombre único del archivo subido desde req.file.filename
const archivoSubido = req.file;
if (!archivoSubido) {
return res.status(400).json({ msg: "Debes subir un archivo PDF" });
}
// Genera una URL basada en el nombre único del archivo
const pdfUrl = /uploads/pdfs/${archivoSubido.filename}
;
// Crea un registro en la base de datos con la URL del archivo
const usuarioPDFURL = await prisma.pdf_url.create({
data: {
fecha_pdf_url: fechaPagoFormateada,
usuarioId: parseInt(id),
pdf_url: pdfUrl, // Almacena la URL en el campo pdf_url
},
});
2. Can I set up an automatic backup for my MySQL database?.
3. I have three components: the first and second are frontends, and the last one is the backend. I've assigned a domain to the first component, but I'm unable to use that domain in the other components. Is this configuration acceptable? I intended to use the same domain for all components. Thanks you all.6 Replies
Project ID:
N/A
N/A
1) you should be using volumes to store any data that needs to persist between deploys. The container itself is ephemeral and will be wiped on each deploy
2) there are templates at http://railway.app/templates for database backups, or you can connect with an app like DBeaver or MySQL Workbench to generate an SQL dump to import later if necessary
1. all file access has to be done by your app, railway doesn't provide any ftp access or a filebrowser, but either way you'd likely want to use a volume https://docs.railway.app/reference/volumes
2. there are lots of templates to do just that https://railway.app/templates
3. you would have multiple railway services for that, with domain.com for the frontend and something like api.domain.com for the backend
4. vin is cool
Beat me to 3, and I agree with 4
4a) Brody is cooler than vin
Thanks, guys, you saved me from getting fired haha you both are cool!