2023-12-03 19:52:09 +04:00
|
|
|
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');
|
2023-12-10 22:07:47 +04:00
|
|
|
});
|