18 lines
456 B
JavaScript
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');
|
|
});
|