eguneraketa
This commit is contained in:
parent
1d907bfb2c
commit
4ddd03e135
17
README.md
17
README.md
@ -1,3 +1,16 @@
|
||||
# ariketa-02
|
||||
# Ariketa-02
|
||||
02.-Oinarrizko web aplikazio bat eraiki Node.js, Express.js eta Pug erabiliz - Express.js
|
||||
|
||||
02.-Oinarrizko web aplikazio bat eraiki Node.js, Express.js eta Pug erabiliz - Express.js
|
||||
https://apunteak.lainoa.eus/post603a1959d961a209a4eab0e3
|
||||
|
||||
## Instalakuntza
|
||||
git clone https://git.lainoa.eus/aitzol/ariketa-02.git
|
||||
cd ariketa-02
|
||||
npm install
|
||||
|
||||
## Test
|
||||
node index.js
|
||||
<a href="http://localhost:8080" target="_blank">localhost:8080</a>
|
||||
|
||||
## Demo
|
||||
[demoa](https://lainoa.eus/demoak/ariketa-02)
|
||||
|
14
index.html
Normal file
14
index.html
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Node.js Express.js adibidea</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Kaixo!!</h1>
|
||||
<div>Hau Node.js eta Express.js erabiliz egindako orri estatiko bat da. <a href="irudiak">jarraitu >></a></div>
|
||||
</body>
|
||||
</html>
|
||||
|
29
index.js
Normal file
29
index.js
Normal file
@ -0,0 +1,29 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const path = require('path');
|
||||
|
||||
app.set('port', 8080);
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use('/images', express.static(path.join(__dirname, 'public/images')));
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.status(200).sendFile(__dirname + '/index.html');
|
||||
});
|
||||
|
||||
app.get('/irudiak', (req, res) => {
|
||||
res.status(200).sendFile(__dirname + '/irudiak.html');
|
||||
});
|
||||
|
||||
app.get('/irudi_:num', (req, res) =>{
|
||||
var num = req.params.num;
|
||||
res.status(200).sendFile(__dirname + '/irudi_'+num+'.html');
|
||||
});
|
||||
|
||||
app.get('*', (req, res, next) => {
|
||||
res.status(200).send('Eskatu duzun orrialdea ez da aurkitu!');
|
||||
next();
|
||||
});
|
||||
|
||||
app.listen(app.get('port'), () => {
|
||||
console.log('Zerbitzaria martxan ' + app.get('port') + ' atakan');
|
||||
});
|
18
irudi_1.html
Normal file
18
irudi_1.html
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Irudi 1</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Irudi 1</h1>
|
||||
<div class="edukiontzia">
|
||||
<img class="irudi" src="images/irudi_1.jpg">
|
||||
<p><a href="irudiak"><< itzuli</a></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
18
irudi_2.html
Normal file
18
irudi_2.html
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Irudi 2</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Irudi 2</h1>
|
||||
<div class="edukiontzia">
|
||||
<img class="irudi" src="images/irudi_2.jpg">
|
||||
<p><a href="irudiak"><< itzuli</a></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
18
irudi_3.html
Normal file
18
irudi_3.html
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Irudi 3</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Irudi 3</h1>
|
||||
<div class="edukiontzia">
|
||||
<img class="irudi" src="images/irudi_3.jpg">
|
||||
<p><a href="irudiak"><< itzuli</a></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
31
irudiak.html
Normal file
31
irudiak.html
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Irudiak</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Irudiak</h1>
|
||||
<div class="edukiontzia">
|
||||
<div class="irudiak">
|
||||
<div>
|
||||
<img class="irudi_1" src="images/irudi_1.jpg" onclick="window.location.href='images/irudi_1.jpg'">
|
||||
<p><a href="irudi_1">irudi 1</a></p>
|
||||
</div>
|
||||
<div>
|
||||
<img class="irudi_2" src="images/irudi_2.jpg" onclick="window.location.href='images/irudi_2.jpg'">
|
||||
<p><a href="irudi_2">irudi 2</a></p>
|
||||
</div>
|
||||
<div>
|
||||
<img class="irudi_3" src="images/irudi_3.jpg" onclick="window.location.href='images/irudi_3.jpg'">
|
||||
<p><a href="irudi_3">irudi 3</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p><a href="/"><< itzuli</a></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
17
package.json
Normal file
17
package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "ariketa-02",
|
||||
"version": "1.0.1",
|
||||
"description": "02.-Oinarrizko web aplikazio bat eraiki Node.js, Express.js eta Pug erabiliz - Express.js",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node index.js"
|
||||
},
|
||||
"author": "superuser@lainoa.eus",
|
||||
"license": "GPL-3.0-or-later"
|
||||
}
|
||||
|
43
public/css/styles.css
Normal file
43
public/css/styles.css
Normal file
@ -0,0 +1,43 @@
|
||||
.edukiontzia {
|
||||
display: table;
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
.item1 { grid-area: irudi1; }
|
||||
.item2 { grid-area: irudi2; }
|
||||
.item3 { grid-area: irudi3; }
|
||||
|
||||
.irudi_1, .irudi_2, .irudi_3 {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.irudiak{
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
'irudi1 irudi2 irudi3';
|
||||
grid-gap: 10px;
|
||||
padding: 10px;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 360px) {
|
||||
.irudiak{
|
||||
grid-template-areas:
|
||||
'irudi1'
|
||||
'irudi2'
|
||||
'irudi3';
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 640px) {
|
||||
.irudi{
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: blue;
|
||||
}
|
BIN
public/images/irudi_1.jpg
Normal file
BIN
public/images/irudi_1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
BIN
public/images/irudi_2.jpg
Normal file
BIN
public/images/irudi_2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
BIN
public/images/irudi_3.jpg
Normal file
BIN
public/images/irudi_3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
Loading…
Reference in New Issue
Block a user