const express = require('express'); const app = express(); app.get('/', (req, res) => { res.send('Welcome to Express Server'); }); app.get('/html', (req, res) => { res.send('<h1>Hello from Express</h1>'); }); app.get('/json', (req, res) => { res.json({ message: 'Hello, Express!' }); }); app.listen(3000, () => { console.log('Express server running at http://localhost:3000/'); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter