pseudosubs-v1/srv/index.ts

54 lines
1.6 KiB
TypeScript
Raw Normal View History

import express from 'express';
import * as core from "express-serve-static-core";
2023-10-27 12:01:20 +00:00
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);
2018-12-13 01:10:51 +00:00
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);
2018-12-16 03:49:59 +00:00
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);
}
2023-10-27 12:01:20 +00:00
export const conexionMySQL = (() => {
const con = mysql.createConnection({
host: 'localhost',
2023-10-27 12:20:18 +00:00
user: 'root',
2023-10-27 12:01:20 +00:00
password: '123456789',
database: 'pseudo',
});
2023-10-27 12:01:20 +00:00
con.connect((err) => {
if (!err) {
console.log("MySQL iniciado c:");
} else {
throw err;
}
});
return con;
})();
2018-12-21 00:56:24 +00:00
const color = '#cc2f66';
2023-10-27 12:01:20 +00:00
// module.exports.conexionMySQL = conexionMySQL;