From 19c8dd53ff8db62a74e386a3ec5d7f418c4a81bc Mon Sep 17 00:00:00 2001 From: xfy Date: Tue, 24 Sep 2024 11:53:20 +0800 Subject: [PATCH] refactor(struct): rename folders add oha docs --- frameworks/Bunjs/elysia/.gitignore | 42 +++++++ frameworks/Bunjs/elysia/README.md | 15 +++ frameworks/Bunjs/elysia/bun.lockb | Bin 0 -> 4196 bytes frameworks/Bunjs/elysia/package.json | 15 +++ frameworks/Bunjs/elysia/src/index.ts | 7 ++ frameworks/Bunjs/elysia/tsconfig.json | 103 ++++++++++++++++++ .../Rust/axum/.cargo/config.toml | 0 {web => frameworks}/Rust/axum/.editorconfig | 0 {web => frameworks}/Rust/axum/.env.example | 0 {web => frameworks}/Rust/axum/.gitignore | 0 {web => frameworks}/Rust/axum/Cargo.lock | 0 {web => frameworks}/Rust/axum/Cargo.toml | 0 {web => frameworks}/Rust/axum/Makefile | 0 .../Rust/axum/rust-toolchain.toml | 0 {web => frameworks}/Rust/axum/src/consts.rs | 0 {web => frameworks}/Rust/axum/src/error.rs | 0 {web => frameworks}/Rust/axum/src/main.rs | 0 .../Rust/axum/src/middlewares/mod.rs | 0 .../Rust/axum/src/routes/json.rs | 0 .../Rust/axum/src/routes/mod.rs | 0 .../Rust/axum/src/utils/mod.rs | 0 oha.md | 5 + web/Bunjs/elysia | 1 - 23 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 frameworks/Bunjs/elysia/.gitignore create mode 100644 frameworks/Bunjs/elysia/README.md create mode 100755 frameworks/Bunjs/elysia/bun.lockb create mode 100644 frameworks/Bunjs/elysia/package.json create mode 100644 frameworks/Bunjs/elysia/src/index.ts create mode 100644 frameworks/Bunjs/elysia/tsconfig.json rename {web => frameworks}/Rust/axum/.cargo/config.toml (100%) rename {web => frameworks}/Rust/axum/.editorconfig (100%) rename {web => frameworks}/Rust/axum/.env.example (100%) rename {web => frameworks}/Rust/axum/.gitignore (100%) rename {web => frameworks}/Rust/axum/Cargo.lock (100%) rename {web => frameworks}/Rust/axum/Cargo.toml (100%) rename {web => frameworks}/Rust/axum/Makefile (100%) rename {web => frameworks}/Rust/axum/rust-toolchain.toml (100%) rename {web => frameworks}/Rust/axum/src/consts.rs (100%) rename {web => frameworks}/Rust/axum/src/error.rs (100%) rename {web => frameworks}/Rust/axum/src/main.rs (100%) rename {web => frameworks}/Rust/axum/src/middlewares/mod.rs (100%) rename {web => frameworks}/Rust/axum/src/routes/json.rs (100%) rename {web => frameworks}/Rust/axum/src/routes/mod.rs (100%) rename {web => frameworks}/Rust/axum/src/utils/mod.rs (100%) create mode 100644 oha.md delete mode 160000 web/Bunjs/elysia diff --git a/frameworks/Bunjs/elysia/.gitignore b/frameworks/Bunjs/elysia/.gitignore new file mode 100644 index 0000000..87e5610 --- /dev/null +++ b/frameworks/Bunjs/elysia/.gitignore @@ -0,0 +1,42 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel + +**/*.trace +**/*.zip +**/*.tar.gz +**/*.tgz +**/*.log +package-lock.json +**/*.bun \ No newline at end of file diff --git a/frameworks/Bunjs/elysia/README.md b/frameworks/Bunjs/elysia/README.md new file mode 100644 index 0000000..688c87e --- /dev/null +++ b/frameworks/Bunjs/elysia/README.md @@ -0,0 +1,15 @@ +# Elysia with Bun runtime + +## Getting Started +To get started with this template, simply paste this command into your terminal: +```bash +bun create elysia ./elysia-example +``` + +## Development +To start the development server run: +```bash +bun run dev +``` + +Open http://localhost:3000/ with your browser to see the result. \ No newline at end of file diff --git a/frameworks/Bunjs/elysia/bun.lockb b/frameworks/Bunjs/elysia/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..3e47c8cb4b51c48931809cfab2553988ee490421 GIT binary patch literal 4196 z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Cq&8L|kUVj=_kgp-3{yS&a`A(4kqjCZ z_;Ez1=?N;1ruCGMNMs;lNs2b4;aYuSJca8Fu_DVijY!Begc9I2uv0pAO&~>TRT?E} z5J8S;U8-71(ZU!)rHdhiMgu8S=@RuiEup1#dP1wzla{s23#tsHo*rV=rx0NAr}{!m z=%5WlPz-7fpc`}yY!3u-7-mZX0vbz0XwJT2FwZy(z!|pzyg9LlVHgM&Kn}Fc;Q;vs z!(n!;D1~AgS`daI+{2m$2;pR*C5I(4$Y#{WkSZo(L$I)?0UCB!Xij{uVRkiOH9)6O PLh}JLXBTrO{&VUtUXm~L literal 0 HcmV?d00001 diff --git a/frameworks/Bunjs/elysia/package.json b/frameworks/Bunjs/elysia/package.json new file mode 100644 index 0000000..1e60d34 --- /dev/null +++ b/frameworks/Bunjs/elysia/package.json @@ -0,0 +1,15 @@ +{ + "name": "elysia", + "version": "1.0.50", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "dev": "bun run --watch src/index.ts" + }, + "dependencies": { + "elysia": "latest" + }, + "devDependencies": { + "bun-types": "latest" + }, + "module": "src/index.js" +} \ No newline at end of file diff --git a/frameworks/Bunjs/elysia/src/index.ts b/frameworks/Bunjs/elysia/src/index.ts new file mode 100644 index 0000000..9c1f7a1 --- /dev/null +++ b/frameworks/Bunjs/elysia/src/index.ts @@ -0,0 +1,7 @@ +import { Elysia } from "elysia"; + +const app = new Elysia().get("/", () => "Hello Elysia").listen(3000); + +console.log( + `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}` +); diff --git a/frameworks/Bunjs/elysia/tsconfig.json b/frameworks/Bunjs/elysia/tsconfig.json new file mode 100644 index 0000000..1ca2350 --- /dev/null +++ b/frameworks/Bunjs/elysia/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "ES2022", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + "types": ["bun-types"], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/web/Rust/axum/.cargo/config.toml b/frameworks/Rust/axum/.cargo/config.toml similarity index 100% rename from web/Rust/axum/.cargo/config.toml rename to frameworks/Rust/axum/.cargo/config.toml diff --git a/web/Rust/axum/.editorconfig b/frameworks/Rust/axum/.editorconfig similarity index 100% rename from web/Rust/axum/.editorconfig rename to frameworks/Rust/axum/.editorconfig diff --git a/web/Rust/axum/.env.example b/frameworks/Rust/axum/.env.example similarity index 100% rename from web/Rust/axum/.env.example rename to frameworks/Rust/axum/.env.example diff --git a/web/Rust/axum/.gitignore b/frameworks/Rust/axum/.gitignore similarity index 100% rename from web/Rust/axum/.gitignore rename to frameworks/Rust/axum/.gitignore diff --git a/web/Rust/axum/Cargo.lock b/frameworks/Rust/axum/Cargo.lock similarity index 100% rename from web/Rust/axum/Cargo.lock rename to frameworks/Rust/axum/Cargo.lock diff --git a/web/Rust/axum/Cargo.toml b/frameworks/Rust/axum/Cargo.toml similarity index 100% rename from web/Rust/axum/Cargo.toml rename to frameworks/Rust/axum/Cargo.toml diff --git a/web/Rust/axum/Makefile b/frameworks/Rust/axum/Makefile similarity index 100% rename from web/Rust/axum/Makefile rename to frameworks/Rust/axum/Makefile diff --git a/web/Rust/axum/rust-toolchain.toml b/frameworks/Rust/axum/rust-toolchain.toml similarity index 100% rename from web/Rust/axum/rust-toolchain.toml rename to frameworks/Rust/axum/rust-toolchain.toml diff --git a/web/Rust/axum/src/consts.rs b/frameworks/Rust/axum/src/consts.rs similarity index 100% rename from web/Rust/axum/src/consts.rs rename to frameworks/Rust/axum/src/consts.rs diff --git a/web/Rust/axum/src/error.rs b/frameworks/Rust/axum/src/error.rs similarity index 100% rename from web/Rust/axum/src/error.rs rename to frameworks/Rust/axum/src/error.rs diff --git a/web/Rust/axum/src/main.rs b/frameworks/Rust/axum/src/main.rs similarity index 100% rename from web/Rust/axum/src/main.rs rename to frameworks/Rust/axum/src/main.rs diff --git a/web/Rust/axum/src/middlewares/mod.rs b/frameworks/Rust/axum/src/middlewares/mod.rs similarity index 100% rename from web/Rust/axum/src/middlewares/mod.rs rename to frameworks/Rust/axum/src/middlewares/mod.rs diff --git a/web/Rust/axum/src/routes/json.rs b/frameworks/Rust/axum/src/routes/json.rs similarity index 100% rename from web/Rust/axum/src/routes/json.rs rename to frameworks/Rust/axum/src/routes/json.rs diff --git a/web/Rust/axum/src/routes/mod.rs b/frameworks/Rust/axum/src/routes/mod.rs similarity index 100% rename from web/Rust/axum/src/routes/mod.rs rename to frameworks/Rust/axum/src/routes/mod.rs diff --git a/web/Rust/axum/src/utils/mod.rs b/frameworks/Rust/axum/src/utils/mod.rs similarity index 100% rename from web/Rust/axum/src/utils/mod.rs rename to frameworks/Rust/axum/src/utils/mod.rs diff --git a/oha.md b/oha.md new file mode 100644 index 0000000..382a291 --- /dev/null +++ b/oha.md @@ -0,0 +1,5 @@ +disable keepalive + +```sh +oha -z 10sec -c 50 -j --latency-correction --disable-keepalive http://localhost:4001/json +``` diff --git a/web/Bunjs/elysia b/web/Bunjs/elysia deleted file mode 160000 index de891a6..0000000 --- a/web/Bunjs/elysia +++ /dev/null @@ -1 +0,0 @@ -Subproject commit de891a6187c73c11911e6d7256fcd836e0dd9efb