diff --git a/README.md b/README.md index 52d1ec5..7ca6db6 100644 --- a/README.md +++ b/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 \ No newline at end of file +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 +localhost:8080 + +## Demo +[demoa](https://lainoa.eus/demoak/ariketa-02) diff --git a/index.html b/index.html new file mode 100644 index 0000000..17542eb --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + Node.js Express.js adibidea + + + + +

Kaixo!!

+
Hau Node.js eta Express.js erabiliz egindako orri estatiko bat da. jarraitu >>
+ + + diff --git a/index.js b/index.js new file mode 100644 index 0000000..7b2e548 --- /dev/null +++ b/index.js @@ -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'); +}); diff --git a/irudi_1.html b/irudi_1.html new file mode 100644 index 0000000..25b0e34 --- /dev/null +++ b/irudi_1.html @@ -0,0 +1,18 @@ + + + + + Irudi 1 + + + + +

Irudi 1

+
+ +

<< itzuli

+
+ + + + diff --git a/irudi_2.html b/irudi_2.html new file mode 100644 index 0000000..a1edff3 --- /dev/null +++ b/irudi_2.html @@ -0,0 +1,18 @@ + + + + + Irudi 2 + + + + +

Irudi 2

+
+ +

<< itzuli

+
+ + + + diff --git a/irudi_3.html b/irudi_3.html new file mode 100644 index 0000000..742b4b8 --- /dev/null +++ b/irudi_3.html @@ -0,0 +1,18 @@ + + + + + Irudi 3 + + + + +

Irudi 3

+
+ +

<< itzuli

+
+ + + + diff --git a/irudiak.html b/irudiak.html new file mode 100644 index 0000000..3a727a7 --- /dev/null +++ b/irudiak.html @@ -0,0 +1,31 @@ + + + + + Irudiak + + + + +

Irudiak

+
+
+
+ +

irudi 1

+
+
+ +

irudi 2

+
+
+ +

irudi 3

+
+
+
+

<< itzuli

+ + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..3c23ea6 --- /dev/null +++ b/package.json @@ -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" +} + diff --git a/public/css/styles.css b/public/css/styles.css new file mode 100644 index 0000000..a3c482f --- /dev/null +++ b/public/css/styles.css @@ -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; +} \ No newline at end of file diff --git a/public/images/irudi_1.jpg b/public/images/irudi_1.jpg new file mode 100644 index 0000000..9bbce22 Binary files /dev/null and b/public/images/irudi_1.jpg differ diff --git a/public/images/irudi_2.jpg b/public/images/irudi_2.jpg new file mode 100644 index 0000000..609fd17 Binary files /dev/null and b/public/images/irudi_2.jpg differ diff --git a/public/images/irudi_3.jpg b/public/images/irudi_3.jpg new file mode 100644 index 0000000..e4f88c8 Binary files /dev/null and b/public/images/irudi_3.jpg differ