first commit moving to lappy

This commit is contained in:
Expand 2023-09-29 15:38:34 +10:00
parent ed9ac31e09
commit 3e83c2c0de
7 changed files with 140 additions and 0 deletions

BIN
bun.lockb Executable file

Binary file not shown.

37
index.ts Normal file
View file

@ -0,0 +1,37 @@
const fastify = require('fastify')({
logger: true
})
const path = require("path");
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
fastify.register(require("@fastify/view"), {
engine: {
pug: require("pug")
}
});
fastify.register(require("@fastify/static"), {
root: path.join(__dirname,"public"),
prefix: "/", // optional: default '/'
});
// Declare a route
fastify.get('/', function (request: any, reply: any) {
reply.view('views/index.pug',{
request: request
})
})
fastify.listen({ port: 3000 }, function (err: any, address: any) {
if (err) {
fastify.log.error(err)
process.exit(1)
}
})

18
package.json Normal file
View file

@ -0,0 +1,18 @@
{
"name": "spotdlweb",
"module": "index.ts",
"type": "module",
"devDependencies": {
"bun-types": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"@fastify/static": "^6.11.2",
"@fastify/view": "^8.2.0",
"fastify": "^4.23.2",
"path": "^0.12.7",
"pug": "^3.0.2"
}
}

BIN
public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

22
tsconfig.json Normal file
View file

@ -0,0 +1,22 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "ES2022",
"target": "esnext",
"moduleResolution": "Node",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"types": [
"bun-types" // add Bun global
]
}
}

28
views/index.pug Normal file
View file

@ -0,0 +1,28 @@
extends layout
block content
.container
h1 SO YE WANT TO PIRATE SOM MUSIC???
.card.shadow-lg
form(action='/add_movie', method='POST')
p
| URL:
input(type='text', name='URL', value='')
| Spotify username:
input(type='text', name='USR', value='')
| Spotify Password:
input(type='text', name='PASS', value='')
p
|
input#html(type='radio' name='fav_language' value='HTML')
label(for='html') HTML
br
input#css(type='radio' name='fav_language' value='CSS')
label(for='css') CSS
br
input#javascript(type='radio' name='fav_language' value='JavaScript')
label(for='javascript') JavaScript
br
input(type='submit', value='Submit')

35
views/layout.pug Normal file
View file

@ -0,0 +1,35 @@
doctype html
html
head
title CCashBank
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
link(rel="preconnect" href="https://fonts.gstatic.com")
link(href="https://fonts.googleapis.com/css2?family=Lato&family=Montserrat&display=swap" rel="stylesheet")
body
nav.navbar.navbar-expand-lg.navbar-dark.shadow-lg
.container
.logo
.row
.col
a.navbar-brand(href='/')
img(src="/logo.png" style="width:64px; height:64px")
.col
div.nav-item(style="padding:5px;")
h1 SPOTDLWEB
.container
.container(style="min-height: 3vh")
if errors
div(class="alert alert-danger") #{errors}
if successes
div(class="alert alert-success") #{successes}
br
br
block content
br
hr
script(src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
crossorigin="anonymous")
script(src='/js/main.js')