send files with requests instead of serving the whole repertory in static
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
const path = require('path');
|
||||
|
||||
const mainController = {
|
||||
root: (req, res) => {
|
||||
res.json({
|
||||
message: "Hello, World!",
|
||||
});
|
||||
res.sendFile(path.resolve(__dirname + '/../public/index.html'));
|
||||
},
|
||||
style: (req, res) => {
|
||||
res.sendFile(path.resolve(__dirname + '/../public/style.css'));
|
||||
},
|
||||
script: (req, res) => {
|
||||
res.sendFile(path.resolve(__dirname + '/../public/script.js'));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user