Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions case1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
package-lock.json
build
.env
10 changes: 10 additions & 0 deletions case1/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
roots: ["<rootDir>/tests"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
};


334 changes: 334 additions & 0 deletions case1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
{
"name": "case1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "tests"
},
"dependencies": {
"@types/bcryptjs": "^2.4.2",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.14",
"@types/jsonwebtoken": "^8.5.9",
"@types/knex": "^0.16.1",
"@types/mysql": "^2.15.21",
"@types/uuid": "^8.3.4",
"accepts": "^1.3.8",
"acorn": "^8.8.0",
"acorn-walk": "^8.2.0",
"ansi-escapes": "^4.3.2",
"ansi-regex": "^5.0.1",
"ansi-styles": "^4.3.0",
"anymatch": "^3.1.2",
"arg": "^4.1.3",
"argparse": "^1.0.10",
"array-flatten": "^1.1.1",
"babel-jest": "^29.1.2",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-jest-hoist": "^29.0.2",
"babel-preset-current-node-syntax": "^1.0.1",
"babel-preset-jest": "^29.0.2",
"balanced-match": "^1.0.2",
"bcryptjs": "^2.4.3",
"bignumber.js": "^9.0.0",
"binary-extensions": "^2.2.0",
"body-parser": "^1.20.1",
"brace-expansion": "^1.1.11",
"braces": "^3.0.2",
"browserslist": "^4.21.4",
"bs-logger": "^0.2.6",
"bser": "^2.1.1",
"buffer-equal-constant-time": "^1.0.1",
"buffer-from": "^1.1.2",
"bytes": "^3.1.2",
"call-bind": "^1.0.2",
"callsites": "^3.1.0",
"camelcase": "^5.3.1",
"caniuse-lite": "^1.0.30001418",
"chalk": "^4.1.2",
"char-regex": "^1.0.2",
"chokidar": "^3.5.3",
"ci-info": "^3.5.0",
"cjs-module-lexer": "^1.2.2",
"cliui": "^8.0.1",
"co": "^4.6.0",
"collect-v8-coverage": "^1.0.1",
"color-convert": "^2.0.1",
"color-name": "^1.1.4",
"colorette": "^2.0.19",
"commander": "^9.4.1",
"concat-map": "^0.0.1",
"content-disposition": "^0.5.4",
"content-type": "^1.0.4",
"convert-source-map": "^1.9.0",
"cookie": "^0.5.0",
"cookie-signature": "^1.0.6",
"core-util-is": "^1.0.3",
"cors": "^2.8.5",
"create-require": "^1.1.1",
"cross-spawn": "^7.0.3",
"debug": "^2.6.9",
"dedent": "^0.7.0",
"deepmerge": "^4.2.2",
"depd": "^2.0.0",
"destroy": "^1.2.0",
"detect-newline": "^3.1.0",
"diff": "^4.0.2",
"diff-sequences": "^29.0.0",
"dotenv": "^16.0.3",
"dynamic-dedupe": "^0.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"ee-first": "^1.1.1",
"electron-to-chromium": "^1.4.276",
"emittery": "^0.10.2",
"emoji-regex": "^8.0.0",
"encodeurl": "^1.0.2",
"error-ex": "^1.3.2",
"escalade": "^3.1.1",
"escape-html": "^1.0.3",
"escape-string-regexp": "^2.0.0",
"esm": "^3.2.25",
"esprima": "^4.0.1",
"etag": "^1.8.1",
"execa": "^5.1.1",
"exit": "^0.1.2",
"expect": "^29.1.2",
"express": "^4.18.2",
"fast-json-stable-stringify": "^2.1.0",
"fb-watchman": "^2.0.2",
"fill-range": "^7.0.1",
"finalhandler": "^1.2.0",
"find-up": "^4.1.0",
"forwarded": "^0.2.0",
"fresh": "^0.5.2",
"fs.realpath": "^1.0.0",
"function-bind": "^1.1.1",
"gensync": "^1.0.0-beta.2",
"get-caller-file": "^2.0.5",
"get-intrinsic": "^1.1.3",
"get-package-type": "^0.1.0",
"get-stream": "^6.0.1",
"getopts": "^2.3.0",
"glob": "^7.2.3",
"glob-parent": "^5.1.2",
"globals": "^11.12.0",
"graceful-fs": "^4.2.10",
"has": "^1.0.3",
"has-flag": "^4.0.0",
"has-symbols": "^1.0.3",
"html-escaper": "^2.0.2",
"http-errors": "^2.0.0",
"human-signals": "^2.1.0",
"iconv-lite": "^0.4.24",
"import-local": "^3.1.0",
"imurmurhash": "^0.1.4",
"inflight": "^1.0.6",
"inherits": "^2.0.4",
"interpret": "^2.2.0",
"ipaddr.js": "^1.9.1",
"is-arrayish": "^0.2.1",
"is-binary-path": "^2.1.0",
"is-core-module": "^2.10.0",
"is-extglob": "^2.1.1",
"is-fullwidth-code-point": "^3.0.0",
"is-generator-fn": "^2.1.0",
"is-glob": "^4.0.3",
"is-number": "^7.0.0",
"is-stream": "^2.0.1",
"isarray": "^1.0.0",
"isexe": "^2.0.0",
"istanbul-lib-coverage": "^3.2.0",
"istanbul-lib-instrument": "^5.2.1",
"istanbul-lib-report": "^3.0.0",
"istanbul-lib-source-maps": "^4.0.1",
"istanbul-reports": "^3.1.5",
"jest-changed-files": "^29.0.0",
"jest-circus": "^29.1.2",
"jest-cli": "^29.1.2",
"jest-config": "^29.1.2",
"jest-diff": "^29.1.2",
"jest-docblock": "^29.0.0",
"jest-each": "^29.1.2",
"jest-environment-node": "^29.1.2",
"jest-get-type": "^29.0.0",
"jest-haste-map": "^29.1.2",
"jest-leak-detector": "^29.1.2",
"jest-matcher-utils": "^29.1.2",
"jest-message-util": "^29.1.2",
"jest-mock": "^29.1.2",
"jest-pnp-resolver": "^1.2.2",
"jest-regex-util": "^29.0.0",
"jest-resolve": "^29.1.2",
"jest-resolve-dependencies": "^29.1.2",
"jest-runner": "^29.1.2",
"jest-runtime": "^29.1.2",
"jest-snapshot": "^29.1.2",
"jest-util": "^29.1.2",
"jest-validate": "^29.1.2",
"jest-watcher": "^29.1.2",
"jest-worker": "^29.1.2",
"js-tokens": "^4.0.0",
"js-yaml": "^3.14.1",
"jsesc": "^2.5.2",
"json-parse-even-better-errors": "^2.3.1",
"json5": "^2.2.1",
"jsonwebtoken": "^8.5.1",
"jwa": "^1.4.1",
"jws": "^3.2.2",
"kleur": "^3.0.3",
"knex": "^2.3.0",
"leven": "^3.1.0",
"lines-and-columns": "^1.2.4",
"locate-path": "^5.0.0",
"lodash": "^4.17.21",
"lodash.includes": "^4.3.0",
"lodash.isboolean": "^3.0.3",
"lodash.isinteger": "^4.0.4",
"lodash.isnumber": "^3.0.3",
"lodash.isplainobject": "^4.0.6",
"lodash.isstring": "^4.0.1",
"lodash.memoize": "^4.1.2",
"lodash.once": "^4.1.1",
"lru-cache": "^6.0.0",
"make-dir": "^3.1.0",
"make-error": "^1.3.6",
"makeerror": "^1.0.12",
"media-typer": "^0.3.0",
"merge-descriptors": "^1.0.1",
"merge-stream": "^2.0.0",
"methods": "^1.1.2",
"micromatch": "^4.0.5",
"mime": "^1.6.0",
"mime-db": "^1.52.0",
"mime-types": "^2.1.35",
"mimic-fn": "^2.1.0",
"minimatch": "^3.1.2",
"minimist": "^1.2.6",
"mkdirp": "^1.0.4",
"ms": "^2.0.0",
"mysql": "^2.18.1",
"natural-compare": "^1.4.0",
"negotiator": "^0.6.3",
"node-int64": "^0.4.0",
"node-releases": "^2.0.6",
"normalize-path": "^3.0.0",
"npm-run-path": "^4.0.1",
"object-assign": "^4.1.1",
"object-inspect": "^1.12.2",
"on-finished": "^2.4.1",
"once": "^1.4.0",
"onetime": "^5.1.2",
"p-limit": "^3.1.0",
"p-locate": "^4.1.0",
"p-try": "^2.2.0",
"parse-json": "^5.2.0",
"parseurl": "^1.3.3",
"path-exists": "^4.0.0",
"path-is-absolute": "^1.0.1",
"path-key": "^3.1.1",
"path-parse": "^1.0.7",
"path-to-regexp": "^0.1.7",
"pg-connection-string": "^2.5.0",
"picocolors": "^1.0.0",
"picomatch": "^2.3.1",
"pirates": "^4.0.5",
"pkg-dir": "^4.2.0",
"pretty-format": "^29.1.2",
"process-nextick-args": "^2.0.1",
"prompts": "^2.4.2",
"proxy-addr": "^2.0.7",
"qs": "^6.11.0",
"range-parser": "^1.2.1",
"raw-body": "^2.5.1",
"react-is": "^18.2.0",
"readable-stream": "^2.3.7",
"readdirp": "^3.6.0",
"rechoir": "^0.8.0",
"require-directory": "^2.1.1",
"resolve": "^1.22.1",
"resolve-cwd": "^3.0.0",
"resolve-from": "^5.0.0",
"resolve.exports": "^1.1.0",
"rimraf": "^2.7.1",
"safe-buffer": "^5.2.1",
"safer-buffer": "^2.1.2",
"semver": "^5.7.1",
"send": "^0.18.0",
"serve-static": "^1.15.0",
"setprototypeof": "^1.2.0",
"shebang-command": "^2.0.0",
"shebang-regex": "^3.0.0",
"side-channel": "^1.0.4",
"signal-exit": "^3.0.7",
"sisteransi": "^1.0.5",
"slash": "^3.0.0",
"source-map": "^0.6.1",
"source-map-support": "^0.5.21",
"sprintf-js": "^1.0.3",
"sqlstring": "^2.3.1",
"stack-utils": "^2.0.5",
"statuses": "^2.0.1",
"string_decoder": "^1.1.1",
"string-length": "^4.0.2",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1",
"strip-bom": "^3.0.0",
"strip-final-newline": "^2.0.0",
"strip-json-comments": "^2.0.1",
"supports-color": "^7.2.0",
"supports-hyperlinks": "^2.3.0",
"supports-preserve-symlinks-flag": "^1.0.0",
"tarn": "^3.0.2",
"terminal-link": "^2.1.1",
"test-exclude": "^6.0.0",
"tildify": "^2.0.0",
"tmpl": "^1.0.5",
"to-fast-properties": "^2.0.0",
"to-regex-range": "^5.0.1",
"toidentifier": "^1.0.1",
"tree-kill": "^1.2.2",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"tsconfig": "^7.0.0",
"type-detect": "^4.0.8",
"type-fest": "^0.21.3",
"type-is": "^1.6.18",
"typescript": "^4.8.4",
"unpipe": "^1.0.0",
"update-browserslist-db": "^1.0.10",
"util-deprecate": "^1.0.2",
"utils-merge": "^1.0.1",
"uuid": "^9.0.0",
"v8-compile-cache-lib": "^3.0.1",
"v8-to-istanbul": "^9.0.1",
"vary": "^1.1.2",
"walker": "^1.0.8",
"which": "^2.0.2",
"wrap-ansi": "^7.0.0",
"wrappy": "^1.0.2",
"write-file-atomic": "^4.0.2",
"xtend": "^4.0.2",
"y18n": "^5.0.8",
"yallist": "^4.0.0",
"yargs": "^17.6.0",
"yargs-parser": "^21.1.1",
"yn": "^3.1.1",
"yocto-queue": "^0.1.0"
},
"scripts": {
"dev": "ts-node-dev ./src/index.ts",
"start": "node ./build/index.js",
"build": "tsc" ,
"test": "jest"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/jest": "^29.1.2",
"@types/node": "^18.8.4",
"jest": "^29.1.2",
"ts-jest": "^29.0.3"
}
}
15 changes: 15 additions & 0 deletions case1/request.rest
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

POST http://localhost:3003/product/create
Content-Type: application/json

{
"name": "BLUSA",
"tags": "neutro"
}

###
GET http://localhost:3003/product/8371




21 changes: 21 additions & 0 deletions case1/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import express from "express"
import cors from "cors"
import { AddressInfo } from "net"

export const app = express()

app.use(express.json())
app.use(cors())



const server = app.listen(process.env.PORT || 3003, () => {
if (server) {
const address = server.address() as AddressInfo;
console.log(`Server is running in http://localhost:${address.port}`);
// console.log(`Server is running in ${address.address}:${address.port}`);

} else {
console.error(`Failure upon starting server.`);
}
})
Loading