This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as path from 'node:path' | |
import * as fs from 'node:fs' | |
import { Dirent } from 'node:fs' | |
import { IncomingMessage, ServerResponse } from 'node:http' | |
import { StaticAppFile } from "./static-app-file.js" | |
import { AppConfig } from '../app-config.js' | |
export class StaticAppRouter { | |
private content: { [url: string]: StaticAppFile } = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'node:fs' | |
export enum ContentType { | |
html = 'text/html', | |
css = 'text/css', | |
js = 'application/javascript', | |
ts = 'application/typescript', | |
map = 'application/octet-stream' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import * as http from 'node:https' | |
import * as http from 'node:http' | |
import { IncomingMessage, ServerResponse } from 'node:http' | |
import { StaticAppRouter } from './static-app/static-app-router.js' | |
import { WebSocketRouter } from './websocket/ws-router.js' | |
import { AppConfig } from './app-config.js' | |
class AppServer { | |
private config: AppConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as path from 'node:path' | |
import * as fs from 'node:fs' | |
export class AppConfig { | |
public static readonly ws_rfc_guid: string = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' | |
public readonly server_root: string = process.cwd() | |
public readonly app_dirs: Array<string> = [ | |
'css/', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App { | |
static get random_items(): Array<number> { | |
return Array.from({length: 10}, () => Math.random() * 10 ) | |
} | |
static content_el: HTMLElement | |
static init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--header-height: 8vh; | |
--item-height: 15vh; | |
} | |
body, html { | |
height: 100vh; | |
width: 100vw; | |
overflow: hidden; | |
margin: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>TypeScript Infinite Scroll</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="css/style.css"> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SEQUENCE: public.items_id_seq | |
-- DROP SEQUENCE public.items_id_seq; | |
CREATE SEQUENCE public.items_id_seq; | |
ALTER SEQUENCE public.items_id_seq | |
OWNER TO ts_pg_example_user; | |
-- Table: public.items | |
-- DROP TABLE public.items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Net } from './net.js' | |
export class App { | |
static name_input: HTMLInputElement | |
static desc_input: HTMLInputElement | |
static save_button: HTMLButtonElement | |
static item_list: HTMLElement | |
static init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IsInt, IsString } from 'class-validator'; | |
export class NewItemDto { | |
@IsString() | |
readonly name; | |
@IsString() | |
readonly description; | |
} |