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'); });