first commit

This commit is contained in:
aitzol 2021-03-16 20:09:37 +01:00
parent b5e146708b
commit 77adf56da7
8 changed files with 105 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

View File

@ -1,3 +1,16 @@
# ariketa-03 # Ariketa-03
03.-Oinarrizko web aplikazio bat eraiki Node.js, Express.js eta Pug erabiliz - Pug
03.-Oinarrizko web aplikazio bat eraiki Node.js, Express.js eta Pug erabiliz - Pug https://apunteak.lainoa.eus/post60427300b75d960d00823bb7
## Instalakuntza
git clone https://git.lainoa.eus/aitzol/ariketa-03.git
cd ariketa-03
npm install
## Test
node index.js
<a href="http://localhost:8080" target="_blank">localhost:8080</a>
## Demo
[demoa](https://lainoa.eus/demoak/ariketa-03)

29
index.js Normal file
View 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');
});

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "ariketa-03",
"version": "1.0.2",
"description": "03.-Oinarrizko web aplikazio bat eraiki Node.js, Express.js eta Pug erabiliz - Pug",
"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
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB