Skip to content

Commit

Permalink
clase 19
Browse files Browse the repository at this point in the history
  • Loading branch information
andreybejarano committed Jul 20, 2022
1 parent 1af7bff commit ab02e76
Show file tree
Hide file tree
Showing 16 changed files with 2,044 additions and 0 deletions.
13 changes: 13 additions & 0 deletions clase19/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const express = require('express');

const mainRouter = require('./routers/main');

const app = express();

app.use(express.static('./public'));

app.use('/', mainRouter);

app.listen(3000, () => {
console.log('Server started on http://localhost:3000');
});
12 changes: 12 additions & 0 deletions clase19/controllers/mainController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');

const controller = {
index: (req, res) => {
res.sendFile(path.join(__dirname, '../views/home.html'));
},
about: (req, res) => {
res.sendFile(path.join(__dirname, '../views/about.html'));
}
}

module.exports = controller;
Loading

0 comments on commit ab02e76

Please sign in to comment.