Pibd-21_Ievlewa_M.D._Intern.../js/detailPage.js
2023-12-03 18:52:09 +03:00

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