pseudosubs-v1/srv/index.ts
2023-10-27 07:20:18 -05:00

54 lines
1.6 KiB
TypeScript

import express from 'express';
import * as core from "express-serve-static-core";
import mysql from "mysql2";
console.log("express??");
export default (app: core.Express) => {
app.use(express.json());
app.use(express.urlencoded());
app.get("/");
app.post('/links', require('./LinksAnimes/obtenerLinks').obtenerLinks);
app.put('/links', require('./LinksAnimes/modificarLink').modificarLinks);
app.put('/a/', require('./Admin/crearAnime').crearAnime);
app.get('/a/', require('./Admin/obtenerTodosAnimes').obtenerTodosAnimes);
app.get('/op/:id', require('./Admin/OP/obtenerOPs').obtenerOPs);
app.post('/op/', require('./Admin/OP/nuevoOP').nuevoOP);
app.get('/ed/:anime_ID', require('./Admin/ED/obtenerEDs').obtenerEDs);
app.post('/ed/', require('./Admin/ED/nuevoED').nuevoED);
app.get('/eps/variantes/:anime_ID', require('./Admin/Eps/obtenerVariantes').obtenerVariantes);
app.get('/eps/links/:opcion_ID', require('./Admin/Eps/obtenerLinks').obtenerLinks);
app.post('/eps/links/', require('./Admin/Eps/crearLink').crearLink);
app.get('/estadisticas', require('./Admin/Eps/estadisticas').estadisticas);
}
export const conexionMySQL = (() => {
const con = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '123456789',
database: 'pseudo',
});
con.connect((err) => {
if (!err) {
console.log("MySQL iniciado c:");
} else {
throw err;
}
});
return con;
})();
const color = '#cc2f66';
// module.exports.conexionMySQL = conexionMySQL;