Student Activity
Student Activity (30-min)
bash코드 복사mkdir express-app cd express-app npm init -y npm install express
javascript코드 복사const express = require('express'); const app = express(); // Middleware to log requests app.use((req, res, next) => { console.log(`${req.method} ${req.url}`); next(); }); // Define routes app.get('/', (req, res) => res.send('Welcome to the Home Page')); app.get('/about', (req, res) => res.send('About Us')); app.post('/data', (req, res) => res.send('Data received')); // Start the server const PORT = 3000; app.listen(PORT, () => { console.log(`Server running on http://localhost:${PORT}`); });
bash코드 복사node app.js
Last updated