Skip to content

work_oka #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { fileURLToPath } from "url";
import { MONGODB_URI, PORT } from "./config.js";

import indexRoutes from "./routes/index.routes.js";
import notesRoutes from "./routes/notes.routes.js";
//import notesRoutes from "./routes/notes.routes.js";
import userRoutes from "./routes/auth.routes.js";
import "./config/passport.js";

Expand All @@ -37,6 +37,7 @@ app.set("view engine", ".hbs");
// middlewares
app.use(morgan("dev"));
app.use(express.urlencoded({ extended: false }));
app.use(express.json())
app.use(methodOverride("_method"));
app.use(
session({
Expand All @@ -62,7 +63,7 @@ app.use((req, res, next) => {
// routes
app.use(indexRoutes);
app.use(userRoutes);
app.use(notesRoutes);
//app.use(notesRoutes);

// static files
app.use(express.static(join(__dirname, "public")));
Expand Down
5 changes: 4 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ import { config } from "dotenv";
config();

export const PORT = process.env.PORT || 4000;
export const MONGODB_URI = process.env.MONGODB_URI || "mongodb://localhost/notesdb";
export const MONGODB_URI = process.env.MONGODB_URI || 'mongodb+srv://root:[email protected]/homes?retryWrites=true&w=majority';



2 changes: 1 addition & 1 deletion src/controllers/auth.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const signup = async (req, res) => {
export const renderSigninForm = (req, res) => res.render("auth/signin");

export const signin = passport.authenticate("local", {
successRedirect: "/notes",
successRedirect: "/",
failureRedirect: "/auth/signin",
failureFlash: true,
});
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/index.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export const renderIndex = (req, res) => {
res.render("index");
};

export const renderAbout = (req, res) => {
res.render("about");
export const renderContact = (req, res) => {
res.render("contact");
};
2 changes: 2 additions & 0 deletions src/public/css/main.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
body {
color: white;
background: #121212;
}

}
.logo {
width: 30%;
}
Expand Down
23 changes: 21 additions & 2 deletions src/routes/index.routes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import { Router } from "express";
import { renderIndex, renderAbout } from "../controllers/index.controller.js";
import { renderIndex, renderContact } from "../controllers/index.controller.js";

const router = Router();

router.get("/", renderIndex);
router.get("/about", renderAbout);
router.get("/contact", renderContact);
// Array de proyectos
const projects = [
{
title: "Pokedex",
URI: "https://pokedex-u2jj.onrender.com",
description: "Pokedex de Pokemon"
},
{
title: "App de la galleta de la fortuna ",
URI: "https://galleta.onrender.com",
description: "Cuentas con una galleta que te alegreada el dia con tu fortuna"
},
// Agrega más proyectos aquí...
];

router.get('/proyect', (req, res) => {
res.render('proyect', { projects });
});


export default router;
2 changes: 1 addition & 1 deletion src/views/404.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-4 offset-md-4">
<div class="card card-body">
<div class="card card-body text-primary ">
<h1>Not Found</h1>
<p>This page does not exists</p>
<a href="/">Return to home</a>
Expand Down
8 changes: 0 additions & 8 deletions src/views/about.hbs

This file was deleted.

6 changes: 1 addition & 5 deletions src/views/auth/signin.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
Account Login
</h1>
</div>
<img
class="rounded-circle mx-auto d-block logo m-4"
src="/img/logo.png"
alt="Logo"
/>

<div class="card-body">
<form action="/auth/signin" method="POST">
<div class="mb-3">
Expand Down
45 changes: 45 additions & 0 deletions src/views/contact.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contacto</title>
</head>
<body>
<section class="container row ">
<div class="col card" >
<h1>Contacto</h1>
<pclass="text-light">¡Estamos encantados de hablar contigo! Completa el formulario de abajo para ponerte en contacto con nosotros.</p>

<!-- Formulario de contacto -->
<form>
<div class="mb-3">
<label for="nombre" class="form-label">Nombre</label>
<input type="text" class="form-control" id="nombre" placeholder="Tu nombre">
</div>
<div class="mb-3">
<label for="email" class="form-label">Correo electrónico</label>
<input type="email" class="form-control" id="email" placeholder="Tu correo electrónico">
</div>
<div class="mb-3">
<label for="mensaje" class="form-label">Mensaje</label>
<textarea class="form-control" id="mensaje" rows="4" placeholder="Escribe tu mensaje aquí"></textarea>
</div>
<button type="submit" class="btn btn-primary">Enviar</button>
</form>
</div>
<div class="col-sm-6 card">
<h1>Redes Sociales</h1>

</div>
</div>
</section>

<!-- Pie de página -->
<footer class="bg-dark text-light text-center py-3">
<div class="container">
<p>&copy; 2023 Tu Empresa de Software</p>
</div>
</footer>
</body>
</html>
2 changes: 1 addition & 1 deletion src/views/error.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-4 offset-md-4">
<div class="card card-body">
<div class="card card-body text-primary">
<h1>Internal Server Error</h1>
<p>{{error}}</p>
<a href="/">Return to home</a>
Expand Down
2 changes: 1 addition & 1 deletion src/views/index.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="card card-body p-5 mt-4">
<div class="card card-body p-5 mt-4 text-primary">
<h1 class="display-4">Notes App Nodejs And Mongodb!</h1>
<p class="lead">A simple App to manage Notes developed with Nodejs, Express,
Mongodb and Javascript Technologies</p>
Expand Down
5 changes: 1 addition & 4 deletions src/views/layouts/main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Notes App</title>
<title>My App</title>
<!-- BOOTSTRAP - BOOTSWATCH THEME - COSMOS -->
<link rel="stylesheet" href="https://bootswatch.com/5/lux/bootstrap.min.css">
<!-- FONT AWESOME -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<!-- CUSTOM CSS -->
<link rel="stylesheet" href="/css/main.css">
</head>
<body>
Expand Down
16 changes: 11 additions & 5 deletions src/views/partials/navigation.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-lg navbar-dark p-2 bg-black">
<div class="container">
<a class="navbar-brand" href="/">Notes App</a>
<a class="navbar-brand" href="/">My App</a>
<button
class="navbar-toggler"
type="button"
Expand All @@ -14,8 +14,14 @@
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/proyect">Proyects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
<a class="nav-link" href="/contact">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/blog">MyBlog</a>
</li>
</ul>
<ul class="navbar-nav ms-auto">
Expand All @@ -29,11 +35,11 @@
data-bs-toggle="dropdown"
aria-expanded="false"
>
Notes
Blog
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="/notes">All Notes</a>
<a class="dropdown-item" href="/notes/add">Add A Note</a>
<a class="dropdown-item" href="/blog">All Blogs</a>
<a class="dropdown-item" href="/blog/add">Add A Blog</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/auth/logout">Logout</a>
</ul>
Expand Down
26 changes: 26 additions & 0 deletions src/views/proyect.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<section class="container mt-5">
<div class="card">
<div class="card-body">
<h1>Mis Proyectos</h1>
<div id="ProyectRoot">
{{#each projects}}
<div class="mb-3 card {{ this.bgColor }} {{ this.textColor }}">
<div class="card-header">{{ this.header }}</div>
<div class="card-body">
<h4 class="card-title">{{ this.title }}</h4>
<p class="card-text">{{ this.description }}</p>
<a class="text-info" href="{{ this.URI }}">Ir al proyecto</a>
</div>
</div>
{{/each}}
</div>
</div>
</div>
</section>

<!-- Pie de página -->
<footer class="bg-dark text-light text-center py-3">
<div class="container">
<p>&copy; 2023 Tu Empresa de Software</p>
</div>
</footer>