Showing
1 changed file
with
17 additions
and
0 deletions
app.js
0 → 100644
| 1 | +const express = require('express'); | ||
| 2 | +const path = require('path'); | ||
| 3 | +const app = express(); | ||
| 4 | +app.use(express.static(path.join(__dirname, 'html'))); | ||
| 5 | +app.use((req, res, next) => { | ||
| 6 | + console.log('안녕!'); | ||
| 7 | + next(); | ||
| 8 | +}); | ||
| 9 | +app.get('/', (req, res) => { | ||
| 10 | + res.sendFile(path.join(__dirname, 'html', 'main.html')); | ||
| 11 | +}); | ||
| 12 | +app.get('/about', (req, res) => { | ||
| 13 | + res.sendFile(path.join(__dirname, 'html', 'about.html')); | ||
| 14 | +}); | ||
| 15 | +app.listen(8080, () => { | ||
| 16 | + console.log('Express App on port 8080!'); | ||
| 17 | +}); |
-
Please register or login to post a comment