Headers, endpoints, preparing for dashboard
This commit is contained in:
parent
e4de5a91ee
commit
a61b5aab79
2 changed files with 15 additions and 2 deletions
17
index.js
17
index.js
|
@ -18,15 +18,24 @@ if (!directory) {
|
|||
return
|
||||
}
|
||||
|
||||
app.use(express.static(directory))
|
||||
app.use('/b', express.static(directory))
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log("Now listening on PORT: " + PORT)
|
||||
|
||||
if (!passwd) {
|
||||
console.log("Password variable not found. Uploading from site is not available.")
|
||||
} else {
|
||||
console.log("Password variable found! Uploads are now available on the site.")
|
||||
}
|
||||
})
|
||||
|
||||
app.get("/*", (req, res) => {
|
||||
app.get("/b*", (req, res) => {
|
||||
var file = req.params[0]
|
||||
var absPath = path.join(directory, file)
|
||||
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
|
||||
try {
|
||||
var dirContents = fs.readdirSync(absPath)
|
||||
} catch (error) {
|
||||
|
@ -46,4 +55,8 @@ app.get("/*", (req, res) => {
|
|||
res.write(baseEnd)
|
||||
|
||||
res.end()
|
||||
})
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.redirect("/b")
|
||||
})
|
0
resources/dashboard.html
Normal file
0
resources/dashboard.html
Normal file
Loading…
Reference in a new issue