Pibd-21_Ievlewa_M.D._Intern.../js/detailPage.js
2023-12-10 21:07:47 +03:00

18 lines
456 B
JavaScript

const express = require('express');
const fs = require('fs');
const app = express();
app.get('/artist/:name', (req, res) => {
const artistName = req.params.name;
fs.readFile(`artists/${artistName}.txt`, 'utf8', (err, data) => {
if (err) {
res.status(404).send('File Not Found');
} else {
res.send(data);
}
});
});
app.listen(5500, () => {
console.log('Server is running on port 5500');
});