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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(express.static(directory))
|
app.use('/b', express.static(directory))
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log("Now listening on PORT: " + 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 file = req.params[0]
|
||||||
var absPath = path.join(directory, file)
|
var absPath = path.join(directory, file)
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/html')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var dirContents = fs.readdirSync(absPath)
|
var dirContents = fs.readdirSync(absPath)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -47,3 +56,7 @@ app.get("/*", (req, res) => {
|
||||||
|
|
||||||
res.end()
|
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