PR-220602: Adding first commit.

This commit is contained in:
2025-01-12 04:24:44 +00:00
commit 5eaec8627f
20 changed files with 5599 additions and 0 deletions

17
src/app.ts Normal file
View File

@ -0,0 +1,17 @@
import express from 'express';
import dotenv from 'dotenv';
import { setRoutes } from './routes/index';
dotenv.config();
const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
setRoutes(app);
app.listen(PORT, () => {
console.log(`Servidor corriendo en http://localhost:${PORT}`);
});

14
src/controllers/index.ts Normal file
View File

@ -0,0 +1,14 @@
import { Request, Response } from 'express';
export const getIndex = async (req: Request, res: Response): Promise<void> => {
try {
const cdnUrl = process.env.CDN_URL;
if (!cdnUrl) {
res.status(500).send('CDN URL not configured');
return;
}
res.redirect(cdnUrl);
} catch (error) {
res.status(500).send('Internal Server Error');
}
};

8
src/routes/index.ts Normal file
View File

@ -0,0 +1,8 @@
import { Application, Request, Response } from 'express';
import { getIndex } from '../controllers/index';
export function setRoutes(app: Application) {
app.get('/', (req: Request, res: Response) => {
getIndex(req, res);
});
}

7
src/types/index.ts Normal file
View File

@ -0,0 +1,7 @@
export interface CustomRequest extends Express.Request {
// Puedes agregar propiedades personalizadas aquí
}
export interface CustomResponse extends Express.Response {
// Puedes agregar propiedades personalizadas aquí
}