Skip to content

Commit

Permalink
se genera el primer commit
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-990 committed May 26, 2023
1 parent fc3b831 commit b467bc5
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"servidordb": {
"host": "",
"user": "",
"password": "",
"database": ""
},
"servidor":{
"puerto":5000
}
}
28 changes: 28 additions & 0 deletions database/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const mysql = require('mysql')
const config = require('config');

//rutas para la conexion a base de datos
const host = config.get('servidordb.host');
const user = config.get('servidordb.user');
const pass = config.get('servidordb.password');
const database = config.get('servidordb.database');

const pool = mysql.createPool({
connectionLimit: 4,
waitForConnections: true,
queueLimit: 0,
host: host,
user: user,
password: pass,
database: database
})

pool.getConnection((err, connection) => {
if(err){
console.log('error al conectar a la base de datos');
}else{
console.log('se conecto a la base de datos');
}
})

module.exports = pool;
39 changes: 39 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const config = require('config');

//mysql
const conn = require('./database/db.js');

//puerto
const puerto = config.get('servidor.puerto');
const PORT = process.env.PORT || puerto;

//app
const app = express();
//utilidades
app.set('view engine', 'ejs');
app.use(express.static('public'));

//respuesta del servidor
let respuesta = {
error: false,
codigo: 0,
mensaje: '',
parametro: '',
}

const urlencodedParser = bodyParser.urlencoded({extended: true});
app.use(bodyParser.json()) // for parsing application/json
const jsonParser = bodyParser.json();


//logica de la app
//logica de la app


//corre el servidor
app.listen(PORT, () => {
console.log(`se conecto al: http://localhost:${PORT}`);
})
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "proyectoapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Daniel Arango Villegas <[email protected]> (https://github.com/daniel-990)",
"license": "ISC"
}
Empty file added public/css/main.css
Empty file.
Empty file added public/js/main.js
Empty file.
1 change: 1 addition & 0 deletions views/pages/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Esta es mi pagina de inicio
3 changes: 3 additions & 0 deletions views/partials/footer.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions views/partials/header.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>web</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="#">Logo</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Inicio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Info</a>
</li>
</ul>
</div>
</div>
</nav>

0 comments on commit b467bc5

Please sign in to comment.