forked from curso-github-cefire/deploy_github_actions_sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (27 loc) · 757 Bytes
/
index.js
File metadata and controls
36 lines (27 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var express = require('express');
const bodyParser = require('body-parser')
const app = express()
const router = express.Router()
app.set('view engine', 'pug')
router.use(bodyParser.json())
router.use(bodyParser.urlencoded({ extended: true }))
router.get('/', (req, res) => {
res.render('index', {
title: "Página de bienvenida",
greeting: "Hola",
data: req.query.data
})
})
router.get('/adios', (req, res) => {
res.render('index', {
title: "Página de despedida",
greeting: "Adiós",
data: req.query.data
})
})
app.use('/', router);
// Puerto de escucha
var port = process.env.PORT || 3000;
app.listen(port, function () {
console.log('Servidor escuchando en puerto ' + port);
});