Initial commit
This commit is contained in:
parent
1160e6560e
commit
1c85658ccd
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
*.geany
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
.parcel-cache/
|
||||||
|
package-lock.json
|
||||||
|
public/*
|
||||||
33
package.json
Normal file
33
package.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "updown",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "a simple file uploader/downloader",
|
||||||
|
"main": "updown.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "npx parcel serve updown.js --public-url / --dist-dir dist",
|
||||||
|
"clean": "rm -rf dist/ && rm -rf .parcel-cache/",
|
||||||
|
"build": "npx parcel build --no-optimize --public-url ./ --dist-dir dist"
|
||||||
|
},
|
||||||
|
"author": "eclipse729",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"pug": "^3.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"assert": "^2.1.0",
|
||||||
|
"browserify-zlib": "^0.2.0",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"crypto-browserify": "^3.12.0",
|
||||||
|
"events": "^3.3.0",
|
||||||
|
"parcel": "^2.9.3",
|
||||||
|
"path-browserify": "^1.0.1",
|
||||||
|
"process": "^0.11.10",
|
||||||
|
"querystring-es3": "^0.2.1",
|
||||||
|
"stream-browserify": "^3.0.0",
|
||||||
|
"stream-http": "^3.2.0",
|
||||||
|
"string_decoder": "^1.3.0",
|
||||||
|
"url": "^0.11.3",
|
||||||
|
"util": "^0.12.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
18
updown.js
Normal file
18
updown.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
const express = require('express')
|
||||||
|
const app = express()
|
||||||
|
const port = 3000
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
|
||||||
|
app.set("view engine", "pug");
|
||||||
|
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
res.render("updown", {
|
||||||
|
message: "hello world",
|
||||||
|
files: fs.readdirSync("public/")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Example app listening on port ${port}`)
|
||||||
|
})
|
||||||
17
views/updown.pug
Normal file
17
views/updown.pug
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
doctype html
|
||||||
|
html
|
||||||
|
head(lang="en")
|
||||||
|
title Updown
|
||||||
|
body
|
||||||
|
table
|
||||||
|
form(method='post', action='')
|
||||||
|
tr
|
||||||
|
th
|
||||||
|
a(href='?sort=name') Uploaded File(s)
|
||||||
|
th
|
||||||
|
a(href='?sort=size') Size
|
||||||
|
th
|
||||||
|
input(type='checkbox' onclick='toggleAll(this)')
|
||||||
|
each file in files
|
||||||
|
tr
|
||||||
|
td= file
|
||||||
Loading…
Reference in New Issue
Block a user