2018-11-20 01:28:50 +00:00
|
|
|
import express from 'express';
|
2018-12-21 00:13:51 +00:00
|
|
|
import * as core from "express-serve-static-core";
|
2023-10-27 12:01:20 +00:00
|
|
|
import mysql from "mysql2";
|
|
|
|
|
|
|
|
console.log("express??");
|
2018-11-20 01:28:50 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
export default (app: core.Express) => {
|
2018-11-20 21:52:25 +00:00
|
|
|
|
|
|
|
app.use(express.json());
|
|
|
|
app.use(express.urlencoded());
|
2018-11-20 01:28:50 +00:00
|
|
|
|
|
|
|
app.get("/");
|
2018-11-20 21:52:25 +00:00
|
|
|
|
|
|
|
app.post('/links', require('./LinksAnimes/obtenerLinks').obtenerLinks);
|
2018-11-21 17:58:16 +00:00
|
|
|
app.put('/links', require('./LinksAnimes/modificarLink').modificarLinks);
|
2018-11-20 21:52:25 +00:00
|
|
|
|
2018-11-22 16:46:11 +00:00
|
|
|
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);
|
|
|
|
|
2018-12-20 21:30:16 +00:00
|
|
|
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);
|
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
app.get('/estadisticas', require('./Admin/Eps/estadisticas').estadisticas);
|
2018-11-20 01:28:50 +00:00
|
|
|
}
|
2018-12-21 00:13:51 +00:00
|
|
|
|
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',
|
|
|
|
});
|
2018-12-21 00:13:51 +00:00
|
|
|
|
2023-10-27 12:01:20 +00:00
|
|
|
con.connect((err) => {
|
2018-12-21 00:13:51 +00:00
|
|
|
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;
|