├── DockerExample ├── .dockerignore ├── .gitignore ├── .prettierrc ├── .vscode │ └── settings.json ├── Dockerfile ├── package-lock.json ├── package.json ├── src │ ├── controllers │ │ ├── joi.ts │ │ └── yup.ts │ ├── interfaces │ │ ├── joi.ts │ │ └── yup.ts │ ├── middleware │ │ ├── joi.ts │ │ └── yup.ts │ ├── routes │ │ ├── joi.ts │ │ └── yup.ts │ └── server.ts └── tsconfig.json ├── LICENSE ├── ValidationByJoiExample ├── .gitignore ├── .prettierrc ├── .vscode │ └── settings.json ├── package.json ├── src │ ├── controllers │ │ ├── joi.ts │ │ └── yup.ts │ ├── interfaces │ │ ├── joi.ts │ │ └── yup.ts │ ├── middleware │ │ ├── joi.ts │ │ └── yup.ts │ ├── routes │ │ ├── joi.ts │ │ └── yup.ts │ └── server.ts └── tsconfig.json ├── ValidationByYupExample ├── .gitignore ├── .prettierrc ├── .vscode │ └── settings.json ├── README.md ├── package-lock.json ├── package.json ├── src │ ├── controllers │ │ └── yup.ts │ ├── interfaces │ │ └── yup.ts │ ├── middleware │ │ └── yup.ts │ ├── routes │ │ └── yup.ts │ └── server.ts └── tsconfig.json ├── readme.md ├── typescript-express-nodejs-quickstart ├── .gitignore ├── .prettierrc ├── .vscode │ └── settings.json ├── package.json ├── source │ ├── config │ │ ├── config.ts │ │ └── logging.ts │ ├── controllers │ │ └── sample.ts │ ├── routes │ │ └── sample.ts │ └── server.ts └── tsconfig.json ├── typescript-mongoose-quickstart ├── .gitignore ├── .prettierrc ├── .vscode │ └── settings.json ├── package.json ├── source │ ├── config │ │ ├── config.ts │ │ └── logging.ts │ ├── controllers │ │ └── book.ts │ ├── interfaces │ │ └── book.ts │ ├── models │ │ └── book.ts │ ├── routes │ │ └── book.ts │ └── server.ts └── tsconfig.json └── typescript-mysql-quickstart ├── .gitignore ├── .prettierrc ├── .vscode └── settings.json ├── package.json ├── source ├── config │ ├── config.ts │ ├── logging.ts │ └── mysql.ts ├── controllers │ └── book.ts ├── interfaces │ └── book.ts ├── routes │ └── book.ts └── server.ts └── tsconfig.json /DockerExample/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | build 4 | .vscode -------------------------------------------------------------------------------- /DockerExample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /node_modules -------------------------------------------------------------------------------- /DockerExample/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 200, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "useTabs": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "semi": true 11 | } 12 | -------------------------------------------------------------------------------- /DockerExample/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.bracketPairColorization.enabled": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnPaste": true, 6 | "editor.wordWrap": "on" 7 | } 8 | -------------------------------------------------------------------------------- /DockerExample/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:17 2 | 3 | # Working dir 4 | WORKDIR /usr/src/app 5 | 6 | # Copy files from Build 7 | COPY package*.json ./ 8 | 9 | # Install Globals 10 | RUN npm install prettier -g 11 | 12 | # Install Files 13 | RUN npm install 14 | 15 | # Copy SRC 16 | COPY . . 17 | 18 | # Build 19 | RUN npm run build 20 | 21 | # Open Port 22 | EXPOSE 1337 23 | 24 | # Docker Command to Start Service 25 | CMD [ "node", "build/server.js" ] 26 | -------------------------------------------------------------------------------- /DockerExample/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "joi-example", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "joi-example", 9 | "version": "1.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "express": "^4.17.2", 13 | "joi": "^17.5.0", 14 | "yup": "^0.32.11" 15 | }, 16 | "devDependencies": { 17 | "@types/express": "^4.17.13", 18 | "typescript": "^4.5.4" 19 | } 20 | }, 21 | "node_modules/@babel/runtime": { 22 | "version": "7.16.7", 23 | "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", 24 | "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", 25 | "dependencies": { 26 | "regenerator-runtime": "^0.13.4" 27 | }, 28 | "engines": { 29 | "node": ">=6.9.0" 30 | } 31 | }, 32 | "node_modules/@hapi/hoek": { 33 | "version": "9.2.1", 34 | "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz", 35 | "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==" 36 | }, 37 | "node_modules/@hapi/topo": { 38 | "version": "5.1.0", 39 | "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", 40 | "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", 41 | "dependencies": { 42 | "@hapi/hoek": "^9.0.0" 43 | } 44 | }, 45 | "node_modules/@sideway/address": { 46 | "version": "4.1.3", 47 | "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz", 48 | "integrity": "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==", 49 | "dependencies": { 50 | "@hapi/hoek": "^9.0.0" 51 | } 52 | }, 53 | "node_modules/@sideway/formula": { 54 | "version": "3.0.0", 55 | "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", 56 | "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" 57 | }, 58 | "node_modules/@sideway/pinpoint": { 59 | "version": "2.0.0", 60 | "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", 61 | "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" 62 | }, 63 | "node_modules/@types/body-parser": { 64 | "version": "1.19.2", 65 | "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", 66 | "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", 67 | "dev": true, 68 | "dependencies": { 69 | "@types/connect": "*", 70 | "@types/node": "*" 71 | } 72 | }, 73 | "node_modules/@types/connect": { 74 | "version": "3.4.35", 75 | "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", 76 | "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", 77 | "dev": true, 78 | "dependencies": { 79 | "@types/node": "*" 80 | } 81 | }, 82 | "node_modules/@types/express": { 83 | "version": "4.17.13", 84 | "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", 85 | "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", 86 | "dev": true, 87 | "dependencies": { 88 | "@types/body-parser": "*", 89 | "@types/express-serve-static-core": "^4.17.18", 90 | "@types/qs": "*", 91 | "@types/serve-static": "*" 92 | } 93 | }, 94 | "node_modules/@types/express-serve-static-core": { 95 | "version": "4.17.28", 96 | "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", 97 | "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", 98 | "dev": true, 99 | "dependencies": { 100 | "@types/node": "*", 101 | "@types/qs": "*", 102 | "@types/range-parser": "*" 103 | } 104 | }, 105 | "node_modules/@types/lodash": { 106 | "version": "4.14.178", 107 | "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz", 108 | "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==" 109 | }, 110 | "node_modules/@types/mime": { 111 | "version": "1.3.2", 112 | "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", 113 | "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", 114 | "dev": true 115 | }, 116 | "node_modules/@types/node": { 117 | "version": "17.0.13", 118 | "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", 119 | "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==", 120 | "dev": true 121 | }, 122 | "node_modules/@types/qs": { 123 | "version": "6.9.7", 124 | "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", 125 | "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", 126 | "dev": true 127 | }, 128 | "node_modules/@types/range-parser": { 129 | "version": "1.2.4", 130 | "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", 131 | "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", 132 | "dev": true 133 | }, 134 | "node_modules/@types/serve-static": { 135 | "version": "1.13.10", 136 | "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", 137 | "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", 138 | "dev": true, 139 | "dependencies": { 140 | "@types/mime": "^1", 141 | "@types/node": "*" 142 | } 143 | }, 144 | "node_modules/accepts": { 145 | "version": "1.3.7", 146 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 147 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 148 | "dependencies": { 149 | "mime-types": "~2.1.24", 150 | "negotiator": "0.6.2" 151 | }, 152 | "engines": { 153 | "node": ">= 0.6" 154 | } 155 | }, 156 | "node_modules/array-flatten": { 157 | "version": "1.1.1", 158 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 159 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 160 | }, 161 | "node_modules/body-parser": { 162 | "version": "1.19.1", 163 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", 164 | "integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", 165 | "dependencies": { 166 | "bytes": "3.1.1", 167 | "content-type": "~1.0.4", 168 | "debug": "2.6.9", 169 | "depd": "~1.1.2", 170 | "http-errors": "1.8.1", 171 | "iconv-lite": "0.4.24", 172 | "on-finished": "~2.3.0", 173 | "qs": "6.9.6", 174 | "raw-body": "2.4.2", 175 | "type-is": "~1.6.18" 176 | }, 177 | "engines": { 178 | "node": ">= 0.8" 179 | } 180 | }, 181 | "node_modules/bytes": { 182 | "version": "3.1.1", 183 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", 184 | "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", 185 | "engines": { 186 | "node": ">= 0.8" 187 | } 188 | }, 189 | "node_modules/content-disposition": { 190 | "version": "0.5.4", 191 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 192 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 193 | "dependencies": { 194 | "safe-buffer": "5.2.1" 195 | }, 196 | "engines": { 197 | "node": ">= 0.6" 198 | } 199 | }, 200 | "node_modules/content-type": { 201 | "version": "1.0.4", 202 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 203 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", 204 | "engines": { 205 | "node": ">= 0.6" 206 | } 207 | }, 208 | "node_modules/cookie": { 209 | "version": "0.4.1", 210 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", 211 | "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", 212 | "engines": { 213 | "node": ">= 0.6" 214 | } 215 | }, 216 | "node_modules/cookie-signature": { 217 | "version": "1.0.6", 218 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 219 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 220 | }, 221 | "node_modules/debug": { 222 | "version": "2.6.9", 223 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 224 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 225 | "dependencies": { 226 | "ms": "2.0.0" 227 | } 228 | }, 229 | "node_modules/depd": { 230 | "version": "1.1.2", 231 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 232 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", 233 | "engines": { 234 | "node": ">= 0.6" 235 | } 236 | }, 237 | "node_modules/destroy": { 238 | "version": "1.0.4", 239 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 240 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 241 | }, 242 | "node_modules/ee-first": { 243 | "version": "1.1.1", 244 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 245 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 246 | }, 247 | "node_modules/encodeurl": { 248 | "version": "1.0.2", 249 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 250 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", 251 | "engines": { 252 | "node": ">= 0.8" 253 | } 254 | }, 255 | "node_modules/escape-html": { 256 | "version": "1.0.3", 257 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 258 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 259 | }, 260 | "node_modules/etag": { 261 | "version": "1.8.1", 262 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 263 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", 264 | "engines": { 265 | "node": ">= 0.6" 266 | } 267 | }, 268 | "node_modules/express": { 269 | "version": "4.17.2", 270 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", 271 | "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", 272 | "dependencies": { 273 | "accepts": "~1.3.7", 274 | "array-flatten": "1.1.1", 275 | "body-parser": "1.19.1", 276 | "content-disposition": "0.5.4", 277 | "content-type": "~1.0.4", 278 | "cookie": "0.4.1", 279 | "cookie-signature": "1.0.6", 280 | "debug": "2.6.9", 281 | "depd": "~1.1.2", 282 | "encodeurl": "~1.0.2", 283 | "escape-html": "~1.0.3", 284 | "etag": "~1.8.1", 285 | "finalhandler": "~1.1.2", 286 | "fresh": "0.5.2", 287 | "merge-descriptors": "1.0.1", 288 | "methods": "~1.1.2", 289 | "on-finished": "~2.3.0", 290 | "parseurl": "~1.3.3", 291 | "path-to-regexp": "0.1.7", 292 | "proxy-addr": "~2.0.7", 293 | "qs": "6.9.6", 294 | "range-parser": "~1.2.1", 295 | "safe-buffer": "5.2.1", 296 | "send": "0.17.2", 297 | "serve-static": "1.14.2", 298 | "setprototypeof": "1.2.0", 299 | "statuses": "~1.5.0", 300 | "type-is": "~1.6.18", 301 | "utils-merge": "1.0.1", 302 | "vary": "~1.1.2" 303 | }, 304 | "engines": { 305 | "node": ">= 0.10.0" 306 | } 307 | }, 308 | "node_modules/finalhandler": { 309 | "version": "1.1.2", 310 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 311 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 312 | "dependencies": { 313 | "debug": "2.6.9", 314 | "encodeurl": "~1.0.2", 315 | "escape-html": "~1.0.3", 316 | "on-finished": "~2.3.0", 317 | "parseurl": "~1.3.3", 318 | "statuses": "~1.5.0", 319 | "unpipe": "~1.0.0" 320 | }, 321 | "engines": { 322 | "node": ">= 0.8" 323 | } 324 | }, 325 | "node_modules/forwarded": { 326 | "version": "0.2.0", 327 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 328 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", 329 | "engines": { 330 | "node": ">= 0.6" 331 | } 332 | }, 333 | "node_modules/fresh": { 334 | "version": "0.5.2", 335 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 336 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", 337 | "engines": { 338 | "node": ">= 0.6" 339 | } 340 | }, 341 | "node_modules/http-errors": { 342 | "version": "1.8.1", 343 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", 344 | "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", 345 | "dependencies": { 346 | "depd": "~1.1.2", 347 | "inherits": "2.0.4", 348 | "setprototypeof": "1.2.0", 349 | "statuses": ">= 1.5.0 < 2", 350 | "toidentifier": "1.0.1" 351 | }, 352 | "engines": { 353 | "node": ">= 0.6" 354 | } 355 | }, 356 | "node_modules/iconv-lite": { 357 | "version": "0.4.24", 358 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 359 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 360 | "dependencies": { 361 | "safer-buffer": ">= 2.1.2 < 3" 362 | }, 363 | "engines": { 364 | "node": ">=0.10.0" 365 | } 366 | }, 367 | "node_modules/inherits": { 368 | "version": "2.0.4", 369 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 370 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 371 | }, 372 | "node_modules/ipaddr.js": { 373 | "version": "1.9.1", 374 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 375 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", 376 | "engines": { 377 | "node": ">= 0.10" 378 | } 379 | }, 380 | "node_modules/joi": { 381 | "version": "17.6.0", 382 | "resolved": "https://registry.npmjs.org/joi/-/joi-17.6.0.tgz", 383 | "integrity": "sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==", 384 | "dependencies": { 385 | "@hapi/hoek": "^9.0.0", 386 | "@hapi/topo": "^5.0.0", 387 | "@sideway/address": "^4.1.3", 388 | "@sideway/formula": "^3.0.0", 389 | "@sideway/pinpoint": "^2.0.0" 390 | } 391 | }, 392 | "node_modules/lodash": { 393 | "version": "4.17.21", 394 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 395 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" 396 | }, 397 | "node_modules/lodash-es": { 398 | "version": "4.17.21", 399 | "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", 400 | "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" 401 | }, 402 | "node_modules/media-typer": { 403 | "version": "0.3.0", 404 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 405 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", 406 | "engines": { 407 | "node": ">= 0.6" 408 | } 409 | }, 410 | "node_modules/merge-descriptors": { 411 | "version": "1.0.1", 412 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 413 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 414 | }, 415 | "node_modules/methods": { 416 | "version": "1.1.2", 417 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 418 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", 419 | "engines": { 420 | "node": ">= 0.6" 421 | } 422 | }, 423 | "node_modules/mime": { 424 | "version": "1.6.0", 425 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 426 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 427 | "bin": { 428 | "mime": "cli.js" 429 | }, 430 | "engines": { 431 | "node": ">=4" 432 | } 433 | }, 434 | "node_modules/mime-db": { 435 | "version": "1.51.0", 436 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", 437 | "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", 438 | "engines": { 439 | "node": ">= 0.6" 440 | } 441 | }, 442 | "node_modules/mime-types": { 443 | "version": "2.1.34", 444 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", 445 | "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", 446 | "dependencies": { 447 | "mime-db": "1.51.0" 448 | }, 449 | "engines": { 450 | "node": ">= 0.6" 451 | } 452 | }, 453 | "node_modules/ms": { 454 | "version": "2.0.0", 455 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 456 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 457 | }, 458 | "node_modules/nanoclone": { 459 | "version": "0.2.1", 460 | "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", 461 | "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" 462 | }, 463 | "node_modules/negotiator": { 464 | "version": "0.6.2", 465 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 466 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", 467 | "engines": { 468 | "node": ">= 0.6" 469 | } 470 | }, 471 | "node_modules/on-finished": { 472 | "version": "2.3.0", 473 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 474 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 475 | "dependencies": { 476 | "ee-first": "1.1.1" 477 | }, 478 | "engines": { 479 | "node": ">= 0.8" 480 | } 481 | }, 482 | "node_modules/parseurl": { 483 | "version": "1.3.3", 484 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 485 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", 486 | "engines": { 487 | "node": ">= 0.8" 488 | } 489 | }, 490 | "node_modules/path-to-regexp": { 491 | "version": "0.1.7", 492 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 493 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 494 | }, 495 | "node_modules/property-expr": { 496 | "version": "2.0.5", 497 | "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", 498 | "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" 499 | }, 500 | "node_modules/proxy-addr": { 501 | "version": "2.0.7", 502 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 503 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 504 | "dependencies": { 505 | "forwarded": "0.2.0", 506 | "ipaddr.js": "1.9.1" 507 | }, 508 | "engines": { 509 | "node": ">= 0.10" 510 | } 511 | }, 512 | "node_modules/qs": { 513 | "version": "6.9.6", 514 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", 515 | "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", 516 | "engines": { 517 | "node": ">=0.6" 518 | }, 519 | "funding": { 520 | "url": "https://github.com/sponsors/ljharb" 521 | } 522 | }, 523 | "node_modules/range-parser": { 524 | "version": "1.2.1", 525 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 526 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", 527 | "engines": { 528 | "node": ">= 0.6" 529 | } 530 | }, 531 | "node_modules/raw-body": { 532 | "version": "2.4.2", 533 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", 534 | "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", 535 | "dependencies": { 536 | "bytes": "3.1.1", 537 | "http-errors": "1.8.1", 538 | "iconv-lite": "0.4.24", 539 | "unpipe": "1.0.0" 540 | }, 541 | "engines": { 542 | "node": ">= 0.8" 543 | } 544 | }, 545 | "node_modules/regenerator-runtime": { 546 | "version": "0.13.9", 547 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", 548 | "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" 549 | }, 550 | "node_modules/safe-buffer": { 551 | "version": "5.2.1", 552 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 553 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 554 | "funding": [ 555 | { 556 | "type": "github", 557 | "url": "https://github.com/sponsors/feross" 558 | }, 559 | { 560 | "type": "patreon", 561 | "url": "https://www.patreon.com/feross" 562 | }, 563 | { 564 | "type": "consulting", 565 | "url": "https://feross.org/support" 566 | } 567 | ] 568 | }, 569 | "node_modules/safer-buffer": { 570 | "version": "2.1.2", 571 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 572 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 573 | }, 574 | "node_modules/send": { 575 | "version": "0.17.2", 576 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", 577 | "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", 578 | "dependencies": { 579 | "debug": "2.6.9", 580 | "depd": "~1.1.2", 581 | "destroy": "~1.0.4", 582 | "encodeurl": "~1.0.2", 583 | "escape-html": "~1.0.3", 584 | "etag": "~1.8.1", 585 | "fresh": "0.5.2", 586 | "http-errors": "1.8.1", 587 | "mime": "1.6.0", 588 | "ms": "2.1.3", 589 | "on-finished": "~2.3.0", 590 | "range-parser": "~1.2.1", 591 | "statuses": "~1.5.0" 592 | }, 593 | "engines": { 594 | "node": ">= 0.8.0" 595 | } 596 | }, 597 | "node_modules/send/node_modules/ms": { 598 | "version": "2.1.3", 599 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 600 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 601 | }, 602 | "node_modules/serve-static": { 603 | "version": "1.14.2", 604 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", 605 | "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", 606 | "dependencies": { 607 | "encodeurl": "~1.0.2", 608 | "escape-html": "~1.0.3", 609 | "parseurl": "~1.3.3", 610 | "send": "0.17.2" 611 | }, 612 | "engines": { 613 | "node": ">= 0.8.0" 614 | } 615 | }, 616 | "node_modules/setprototypeof": { 617 | "version": "1.2.0", 618 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 619 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 620 | }, 621 | "node_modules/statuses": { 622 | "version": "1.5.0", 623 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 624 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", 625 | "engines": { 626 | "node": ">= 0.6" 627 | } 628 | }, 629 | "node_modules/toidentifier": { 630 | "version": "1.0.1", 631 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 632 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", 633 | "engines": { 634 | "node": ">=0.6" 635 | } 636 | }, 637 | "node_modules/toposort": { 638 | "version": "2.0.2", 639 | "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", 640 | "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=" 641 | }, 642 | "node_modules/type-is": { 643 | "version": "1.6.18", 644 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 645 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 646 | "dependencies": { 647 | "media-typer": "0.3.0", 648 | "mime-types": "~2.1.24" 649 | }, 650 | "engines": { 651 | "node": ">= 0.6" 652 | } 653 | }, 654 | "node_modules/typescript": { 655 | "version": "4.5.5", 656 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", 657 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", 658 | "dev": true, 659 | "bin": { 660 | "tsc": "bin/tsc", 661 | "tsserver": "bin/tsserver" 662 | }, 663 | "engines": { 664 | "node": ">=4.2.0" 665 | } 666 | }, 667 | "node_modules/unpipe": { 668 | "version": "1.0.0", 669 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 670 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", 671 | "engines": { 672 | "node": ">= 0.8" 673 | } 674 | }, 675 | "node_modules/utils-merge": { 676 | "version": "1.0.1", 677 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 678 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", 679 | "engines": { 680 | "node": ">= 0.4.0" 681 | } 682 | }, 683 | "node_modules/vary": { 684 | "version": "1.1.2", 685 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 686 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", 687 | "engines": { 688 | "node": ">= 0.8" 689 | } 690 | }, 691 | "node_modules/yup": { 692 | "version": "0.32.11", 693 | "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", 694 | "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", 695 | "dependencies": { 696 | "@babel/runtime": "^7.15.4", 697 | "@types/lodash": "^4.14.175", 698 | "lodash": "^4.17.21", 699 | "lodash-es": "^4.17.21", 700 | "nanoclone": "^0.2.1", 701 | "property-expr": "^2.0.4", 702 | "toposort": "^2.0.2" 703 | }, 704 | "engines": { 705 | "node": ">=10" 706 | } 707 | } 708 | }, 709 | "dependencies": { 710 | "@babel/runtime": { 711 | "version": "7.16.7", 712 | "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", 713 | "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", 714 | "requires": { 715 | "regenerator-runtime": "^0.13.4" 716 | } 717 | }, 718 | "@hapi/hoek": { 719 | "version": "9.2.1", 720 | "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz", 721 | "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==" 722 | }, 723 | "@hapi/topo": { 724 | "version": "5.1.0", 725 | "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", 726 | "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", 727 | "requires": { 728 | "@hapi/hoek": "^9.0.0" 729 | } 730 | }, 731 | "@sideway/address": { 732 | "version": "4.1.3", 733 | "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz", 734 | "integrity": "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==", 735 | "requires": { 736 | "@hapi/hoek": "^9.0.0" 737 | } 738 | }, 739 | "@sideway/formula": { 740 | "version": "3.0.0", 741 | "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", 742 | "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" 743 | }, 744 | "@sideway/pinpoint": { 745 | "version": "2.0.0", 746 | "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", 747 | "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" 748 | }, 749 | "@types/body-parser": { 750 | "version": "1.19.2", 751 | "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", 752 | "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", 753 | "dev": true, 754 | "requires": { 755 | "@types/connect": "*", 756 | "@types/node": "*" 757 | } 758 | }, 759 | "@types/connect": { 760 | "version": "3.4.35", 761 | "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", 762 | "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", 763 | "dev": true, 764 | "requires": { 765 | "@types/node": "*" 766 | } 767 | }, 768 | "@types/express": { 769 | "version": "4.17.13", 770 | "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", 771 | "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", 772 | "dev": true, 773 | "requires": { 774 | "@types/body-parser": "*", 775 | "@types/express-serve-static-core": "^4.17.18", 776 | "@types/qs": "*", 777 | "@types/serve-static": "*" 778 | } 779 | }, 780 | "@types/express-serve-static-core": { 781 | "version": "4.17.28", 782 | "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", 783 | "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", 784 | "dev": true, 785 | "requires": { 786 | "@types/node": "*", 787 | "@types/qs": "*", 788 | "@types/range-parser": "*" 789 | } 790 | }, 791 | "@types/lodash": { 792 | "version": "4.14.178", 793 | "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz", 794 | "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==" 795 | }, 796 | "@types/mime": { 797 | "version": "1.3.2", 798 | "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", 799 | "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", 800 | "dev": true 801 | }, 802 | "@types/node": { 803 | "version": "17.0.13", 804 | "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", 805 | "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==", 806 | "dev": true 807 | }, 808 | "@types/qs": { 809 | "version": "6.9.7", 810 | "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", 811 | "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", 812 | "dev": true 813 | }, 814 | "@types/range-parser": { 815 | "version": "1.2.4", 816 | "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", 817 | "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", 818 | "dev": true 819 | }, 820 | "@types/serve-static": { 821 | "version": "1.13.10", 822 | "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", 823 | "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", 824 | "dev": true, 825 | "requires": { 826 | "@types/mime": "^1", 827 | "@types/node": "*" 828 | } 829 | }, 830 | "accepts": { 831 | "version": "1.3.7", 832 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 833 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 834 | "requires": { 835 | "mime-types": "~2.1.24", 836 | "negotiator": "0.6.2" 837 | } 838 | }, 839 | "array-flatten": { 840 | "version": "1.1.1", 841 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 842 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 843 | }, 844 | "body-parser": { 845 | "version": "1.19.1", 846 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", 847 | "integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", 848 | "requires": { 849 | "bytes": "3.1.1", 850 | "content-type": "~1.0.4", 851 | "debug": "2.6.9", 852 | "depd": "~1.1.2", 853 | "http-errors": "1.8.1", 854 | "iconv-lite": "0.4.24", 855 | "on-finished": "~2.3.0", 856 | "qs": "6.9.6", 857 | "raw-body": "2.4.2", 858 | "type-is": "~1.6.18" 859 | } 860 | }, 861 | "bytes": { 862 | "version": "3.1.1", 863 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", 864 | "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==" 865 | }, 866 | "content-disposition": { 867 | "version": "0.5.4", 868 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 869 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 870 | "requires": { 871 | "safe-buffer": "5.2.1" 872 | } 873 | }, 874 | "content-type": { 875 | "version": "1.0.4", 876 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 877 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 878 | }, 879 | "cookie": { 880 | "version": "0.4.1", 881 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", 882 | "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" 883 | }, 884 | "cookie-signature": { 885 | "version": "1.0.6", 886 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 887 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 888 | }, 889 | "debug": { 890 | "version": "2.6.9", 891 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 892 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 893 | "requires": { 894 | "ms": "2.0.0" 895 | } 896 | }, 897 | "depd": { 898 | "version": "1.1.2", 899 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 900 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 901 | }, 902 | "destroy": { 903 | "version": "1.0.4", 904 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 905 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 906 | }, 907 | "ee-first": { 908 | "version": "1.1.1", 909 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 910 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 911 | }, 912 | "encodeurl": { 913 | "version": "1.0.2", 914 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 915 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 916 | }, 917 | "escape-html": { 918 | "version": "1.0.3", 919 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 920 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 921 | }, 922 | "etag": { 923 | "version": "1.8.1", 924 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 925 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 926 | }, 927 | "express": { 928 | "version": "4.17.2", 929 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", 930 | "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", 931 | "requires": { 932 | "accepts": "~1.3.7", 933 | "array-flatten": "1.1.1", 934 | "body-parser": "1.19.1", 935 | "content-disposition": "0.5.4", 936 | "content-type": "~1.0.4", 937 | "cookie": "0.4.1", 938 | "cookie-signature": "1.0.6", 939 | "debug": "2.6.9", 940 | "depd": "~1.1.2", 941 | "encodeurl": "~1.0.2", 942 | "escape-html": "~1.0.3", 943 | "etag": "~1.8.1", 944 | "finalhandler": "~1.1.2", 945 | "fresh": "0.5.2", 946 | "merge-descriptors": "1.0.1", 947 | "methods": "~1.1.2", 948 | "on-finished": "~2.3.0", 949 | "parseurl": "~1.3.3", 950 | "path-to-regexp": "0.1.7", 951 | "proxy-addr": "~2.0.7", 952 | "qs": "6.9.6", 953 | "range-parser": "~1.2.1", 954 | "safe-buffer": "5.2.1", 955 | "send": "0.17.2", 956 | "serve-static": "1.14.2", 957 | "setprototypeof": "1.2.0", 958 | "statuses": "~1.5.0", 959 | "type-is": "~1.6.18", 960 | "utils-merge": "1.0.1", 961 | "vary": "~1.1.2" 962 | } 963 | }, 964 | "finalhandler": { 965 | "version": "1.1.2", 966 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 967 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 968 | "requires": { 969 | "debug": "2.6.9", 970 | "encodeurl": "~1.0.2", 971 | "escape-html": "~1.0.3", 972 | "on-finished": "~2.3.0", 973 | "parseurl": "~1.3.3", 974 | "statuses": "~1.5.0", 975 | "unpipe": "~1.0.0" 976 | } 977 | }, 978 | "forwarded": { 979 | "version": "0.2.0", 980 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 981 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" 982 | }, 983 | "fresh": { 984 | "version": "0.5.2", 985 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 986 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 987 | }, 988 | "http-errors": { 989 | "version": "1.8.1", 990 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", 991 | "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", 992 | "requires": { 993 | "depd": "~1.1.2", 994 | "inherits": "2.0.4", 995 | "setprototypeof": "1.2.0", 996 | "statuses": ">= 1.5.0 < 2", 997 | "toidentifier": "1.0.1" 998 | } 999 | }, 1000 | "iconv-lite": { 1001 | "version": "0.4.24", 1002 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 1003 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 1004 | "requires": { 1005 | "safer-buffer": ">= 2.1.2 < 3" 1006 | } 1007 | }, 1008 | "inherits": { 1009 | "version": "2.0.4", 1010 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 1011 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 1012 | }, 1013 | "ipaddr.js": { 1014 | "version": "1.9.1", 1015 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 1016 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 1017 | }, 1018 | "joi": { 1019 | "version": "17.6.0", 1020 | "resolved": "https://registry.npmjs.org/joi/-/joi-17.6.0.tgz", 1021 | "integrity": "sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==", 1022 | "requires": { 1023 | "@hapi/hoek": "^9.0.0", 1024 | "@hapi/topo": "^5.0.0", 1025 | "@sideway/address": "^4.1.3", 1026 | "@sideway/formula": "^3.0.0", 1027 | "@sideway/pinpoint": "^2.0.0" 1028 | } 1029 | }, 1030 | "lodash": { 1031 | "version": "4.17.21", 1032 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 1033 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" 1034 | }, 1035 | "lodash-es": { 1036 | "version": "4.17.21", 1037 | "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", 1038 | "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" 1039 | }, 1040 | "media-typer": { 1041 | "version": "0.3.0", 1042 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 1043 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 1044 | }, 1045 | "merge-descriptors": { 1046 | "version": "1.0.1", 1047 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 1048 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 1049 | }, 1050 | "methods": { 1051 | "version": "1.1.2", 1052 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 1053 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 1054 | }, 1055 | "mime": { 1056 | "version": "1.6.0", 1057 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 1058 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 1059 | }, 1060 | "mime-db": { 1061 | "version": "1.51.0", 1062 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", 1063 | "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" 1064 | }, 1065 | "mime-types": { 1066 | "version": "2.1.34", 1067 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", 1068 | "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", 1069 | "requires": { 1070 | "mime-db": "1.51.0" 1071 | } 1072 | }, 1073 | "ms": { 1074 | "version": "2.0.0", 1075 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1076 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 1077 | }, 1078 | "nanoclone": { 1079 | "version": "0.2.1", 1080 | "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", 1081 | "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" 1082 | }, 1083 | "negotiator": { 1084 | "version": "0.6.2", 1085 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 1086 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 1087 | }, 1088 | "on-finished": { 1089 | "version": "2.3.0", 1090 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 1091 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 1092 | "requires": { 1093 | "ee-first": "1.1.1" 1094 | } 1095 | }, 1096 | "parseurl": { 1097 | "version": "1.3.3", 1098 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 1099 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 1100 | }, 1101 | "path-to-regexp": { 1102 | "version": "0.1.7", 1103 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 1104 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 1105 | }, 1106 | "property-expr": { 1107 | "version": "2.0.5", 1108 | "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", 1109 | "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" 1110 | }, 1111 | "proxy-addr": { 1112 | "version": "2.0.7", 1113 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 1114 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 1115 | "requires": { 1116 | "forwarded": "0.2.0", 1117 | "ipaddr.js": "1.9.1" 1118 | } 1119 | }, 1120 | "qs": { 1121 | "version": "6.9.6", 1122 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", 1123 | "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==" 1124 | }, 1125 | "range-parser": { 1126 | "version": "1.2.1", 1127 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 1128 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 1129 | }, 1130 | "raw-body": { 1131 | "version": "2.4.2", 1132 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", 1133 | "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", 1134 | "requires": { 1135 | "bytes": "3.1.1", 1136 | "http-errors": "1.8.1", 1137 | "iconv-lite": "0.4.24", 1138 | "unpipe": "1.0.0" 1139 | } 1140 | }, 1141 | "regenerator-runtime": { 1142 | "version": "0.13.9", 1143 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", 1144 | "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" 1145 | }, 1146 | "safe-buffer": { 1147 | "version": "5.2.1", 1148 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 1149 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 1150 | }, 1151 | "safer-buffer": { 1152 | "version": "2.1.2", 1153 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1154 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 1155 | }, 1156 | "send": { 1157 | "version": "0.17.2", 1158 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", 1159 | "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", 1160 | "requires": { 1161 | "debug": "2.6.9", 1162 | "depd": "~1.1.2", 1163 | "destroy": "~1.0.4", 1164 | "encodeurl": "~1.0.2", 1165 | "escape-html": "~1.0.3", 1166 | "etag": "~1.8.1", 1167 | "fresh": "0.5.2", 1168 | "http-errors": "1.8.1", 1169 | "mime": "1.6.0", 1170 | "ms": "2.1.3", 1171 | "on-finished": "~2.3.0", 1172 | "range-parser": "~1.2.1", 1173 | "statuses": "~1.5.0" 1174 | }, 1175 | "dependencies": { 1176 | "ms": { 1177 | "version": "2.1.3", 1178 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1179 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 1180 | } 1181 | } 1182 | }, 1183 | "serve-static": { 1184 | "version": "1.14.2", 1185 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", 1186 | "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", 1187 | "requires": { 1188 | "encodeurl": "~1.0.2", 1189 | "escape-html": "~1.0.3", 1190 | "parseurl": "~1.3.3", 1191 | "send": "0.17.2" 1192 | } 1193 | }, 1194 | "setprototypeof": { 1195 | "version": "1.2.0", 1196 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 1197 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 1198 | }, 1199 | "statuses": { 1200 | "version": "1.5.0", 1201 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 1202 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 1203 | }, 1204 | "toidentifier": { 1205 | "version": "1.0.1", 1206 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 1207 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" 1208 | }, 1209 | "toposort": { 1210 | "version": "2.0.2", 1211 | "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", 1212 | "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=" 1213 | }, 1214 | "type-is": { 1215 | "version": "1.6.18", 1216 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 1217 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 1218 | "requires": { 1219 | "media-typer": "0.3.0", 1220 | "mime-types": "~2.1.24" 1221 | } 1222 | }, 1223 | "typescript": { 1224 | "version": "4.5.5", 1225 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", 1226 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", 1227 | "dev": true 1228 | }, 1229 | "unpipe": { 1230 | "version": "1.0.0", 1231 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 1232 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 1233 | }, 1234 | "utils-merge": { 1235 | "version": "1.0.1", 1236 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 1237 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 1238 | }, 1239 | "vary": { 1240 | "version": "1.1.2", 1241 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 1242 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 1243 | }, 1244 | "yup": { 1245 | "version": "0.32.11", 1246 | "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", 1247 | "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", 1248 | "requires": { 1249 | "@babel/runtime": "^7.15.4", 1250 | "@types/lodash": "^4.14.175", 1251 | "lodash": "^4.17.21", 1252 | "lodash-es": "^4.17.21", 1253 | "nanoclone": "^0.2.1", 1254 | "property-expr": "^2.0.4", 1255 | "toposort": "^2.0.2" 1256 | } 1257 | } 1258 | } 1259 | } 1260 | -------------------------------------------------------------------------------- /DockerExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "joi-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/server.ts", 6 | "scripts": { 7 | "build": "rm -rf build && prettier --write src/ && tsc" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "express": "^4.17.2", 13 | "joi": "^17.5.0", 14 | "yup": "^0.32.11" 15 | }, 16 | "devDependencies": { 17 | "@types/express": "^4.17.13", 18 | "typescript": "^4.5.4" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DockerExample/src/controllers/joi.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import { IJoiData } from '../interfaces/joi'; 3 | 4 | const joiSampleRoute = (req: Request, res: Response, next: NextFunction) => { 5 | const data = req.body as IJoiData; 6 | 7 | return res.status(200).json({ 8 | data 9 | }); 10 | }; 11 | 12 | export default { joiSampleRoute }; 13 | -------------------------------------------------------------------------------- /DockerExample/src/controllers/yup.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import { IYupData } from '../interfaces/yup'; 3 | 4 | const yupSampleRoute = (req: Request, res: Response, next: NextFunction) => { 5 | return res.status(200).json({ 6 | data: res.locals.data as IYupData 7 | }); 8 | }; 9 | 10 | export default { yupSampleRoute }; 11 | -------------------------------------------------------------------------------- /DockerExample/src/interfaces/joi.ts: -------------------------------------------------------------------------------- 1 | export interface IJoiData { 2 | username: string; 3 | password: string; 4 | email: string; 5 | birth_year?: number; 6 | } 7 | -------------------------------------------------------------------------------- /DockerExample/src/interfaces/yup.ts: -------------------------------------------------------------------------------- 1 | export interface IYupData { 2 | name: string; 3 | age: number; 4 | email?: string | undefined; 5 | website?: string | null | undefined; 6 | createdOn: Date; 7 | } 8 | -------------------------------------------------------------------------------- /DockerExample/src/middleware/joi.ts: -------------------------------------------------------------------------------- 1 | import Joi, { ObjectSchema } from 'joi'; 2 | import { NextFunction, Request, Response } from 'express'; 3 | import { IJoiData } from '../interfaces/joi'; 4 | 5 | export const ValidateJoi = (schema: ObjectSchema) => { 6 | return async (req: Request, res: Response, next: NextFunction) => { 7 | try { 8 | await schema.validateAsync(req.body); 9 | 10 | next(); 11 | } catch (error) { 12 | console.error(error); 13 | 14 | return res.status(422).json({ error }); 15 | } 16 | }; 17 | }; 18 | 19 | export const Schemas = { 20 | data: Joi.object({ 21 | username: Joi.string().alphanum().min(3).max(15).required(), 22 | password: Joi.string().pattern(new RegExp('^[a-zA-Z0-9]{3,30}$')).required(), 23 | email: Joi.string() 24 | .email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } }) 25 | .required(), 26 | birth_year: Joi.number().integer().min(1900).max(2013) 27 | }) 28 | }; 29 | -------------------------------------------------------------------------------- /DockerExample/src/middleware/yup.ts: -------------------------------------------------------------------------------- 1 | import { object, string, number, date, AnyObjectSchema } from 'yup'; 2 | import { NextFunction, Request, Response } from 'express'; 3 | 4 | export const ValidateYup = (schema: AnyObjectSchema) => { 5 | return async (req: Request, res: Response, next: NextFunction) => { 6 | try { 7 | const data = await schema.validate(req.body); 8 | 9 | console.log(data); 10 | 11 | next(); 12 | } catch (error) { 13 | console.error(error); 14 | 15 | return res.status(422).json({ error }); 16 | } 17 | }; 18 | }; 19 | 20 | export const Schemas = { 21 | data: object().shape({ 22 | name: string().required(), 23 | age: number().required().positive().integer(), 24 | email: string().email(), 25 | website: string().url(), 26 | createdOn: date().default(() => new Date()) 27 | }) 28 | }; 29 | -------------------------------------------------------------------------------- /DockerExample/src/routes/joi.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/joi'; 3 | import { Schemas, ValidateJoi } from '../middleware/joi'; 4 | 5 | const router = express.Router(); 6 | 7 | router.post('/', ValidateJoi(Schemas.data), controller.joiSampleRoute); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /DockerExample/src/routes/yup.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/yup'; 3 | import { Schemas, ValidateYup } from '../middleware/yup'; 4 | 5 | const router = express.Router(); 6 | 7 | router.post('/', ValidateYup(Schemas.data), controller.yupSampleRoute); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /DockerExample/src/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | import express from 'express'; 3 | import joiRoutes from './routes/joi'; 4 | import yupRoutes from './routes/yup'; 5 | 6 | const router = express(); 7 | 8 | /** Log the request */ 9 | router.use((req, res, next) => { 10 | /** Log the req */ 11 | console.info(`METHOD: [${req.method}] - URL: [${req.url}] - IP: [${req.socket.remoteAddress}]`); 12 | 13 | res.on('finish', () => { 14 | /** Log the res */ 15 | console.info(`METHOD: [${req.method}] - URL: [${req.url}] - STATUS: [${res.statusCode}] - IP: [${req.socket.remoteAddress}]`); 16 | }); 17 | 18 | next(); 19 | }); 20 | 21 | router.use(express.urlencoded({ extended: true })); 22 | router.use(express.json()); 23 | 24 | /** Rules of our API */ 25 | router.use((req, res, next) => { 26 | res.header('Access-Control-Allow-Origin', '*'); 27 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); 28 | 29 | if (req.method == 'OPTIONS') { 30 | res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); 31 | return res.status(200).json({}); 32 | } 33 | 34 | next(); 35 | }); 36 | 37 | /** Routes */ 38 | router.use('/joi', joiRoutes); 39 | router.use('/yup', yupRoutes); 40 | 41 | /** Error handling */ 42 | router.use((req, res, next) => { 43 | const error = new Error('Not found'); 44 | 45 | return res.status(404).json({ 46 | message: error.message 47 | }); 48 | }); 49 | 50 | const httpServer = http.createServer(router); 51 | httpServer.listen(1337, () => console.info('Server is running on port 1337 ...')); 52 | -------------------------------------------------------------------------------- /DockerExample/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Enable incremental compilation */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ 22 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | 26 | /* Modules */ 27 | "module": "commonjs", /* Specify what module code is generated. */ 28 | // "rootDir": "./", /* Specify the root folder within your source files. */ 29 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 30 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 31 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 32 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 33 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ 34 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 35 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 36 | // "resolveJsonModule": true, /* Enable importing .json files */ 37 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ 38 | 39 | /* JavaScript Support */ 40 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ 41 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 42 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ 43 | 44 | /* Emit */ 45 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 46 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 47 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 48 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 49 | // "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. */ 50 | "outDir": "./build", /* Specify an output folder for all emitted files. */ 51 | // "removeComments": true, /* Disable emitting comments. */ 52 | // "noEmit": true, /* Disable emitting files from a compilation. */ 53 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 54 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ 55 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 56 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 58 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 59 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 60 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 61 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 62 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ 63 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ 64 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 65 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ 66 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 67 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 68 | 69 | /* Interop Constraints */ 70 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 71 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 72 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ 73 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 74 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 75 | 76 | /* Type Checking */ 77 | "strict": true, /* Enable all strict type-checking options. */ 78 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ 79 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ 80 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 81 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ 82 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 83 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ 84 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ 85 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 86 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ 87 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ 88 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 89 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 90 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 91 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 92 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 93 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ 94 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 95 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 96 | 97 | /* Completeness */ 98 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 99 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 100 | }, 101 | "include": ["src/**/*.ts"] 102 | } 103 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Saman Arif 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ValidationByJoiExample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /node_modules -------------------------------------------------------------------------------- /ValidationByJoiExample/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 200, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "useTabs": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "semi": true 11 | } 12 | -------------------------------------------------------------------------------- /ValidationByJoiExample/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.bracketPairColorization.enabled": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnPaste": true, 6 | "editor.wordWrap": "on" 7 | } 8 | -------------------------------------------------------------------------------- /ValidationByJoiExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "joi-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/server.ts", 6 | "scripts": { 7 | "build": "rm -rf build && prettier --write src/ && tsc" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "express": "^4.17.2", 13 | "joi": "^17.5.0", 14 | "yup": "^0.32.11" 15 | }, 16 | "devDependencies": { 17 | "@types/express": "^4.17.13", 18 | "typescript": "^4.5.4" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/controllers/joi.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import { IJoiData } from '../interfaces/joi'; 3 | 4 | const joiSampleRoute = (req: Request, res: Response, next: NextFunction) => { 5 | const data = req.body as IJoiData; 6 | 7 | return res.status(200).json({ 8 | data 9 | }); 10 | }; 11 | 12 | export default { joiSampleRoute }; 13 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/controllers/yup.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import { IYupData } from '../interfaces/yup'; 3 | 4 | const yupSampleRoute = (req: Request, res: Response, next: NextFunction) => { 5 | return res.status(200).json({ 6 | data: res.locals.data as IYupData 7 | }); 8 | }; 9 | 10 | export default { yupSampleRoute }; 11 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/interfaces/joi.ts: -------------------------------------------------------------------------------- 1 | export interface IJoiData { 2 | username: string; 3 | password: string; 4 | email: string; 5 | birth_year?: number; 6 | } 7 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/interfaces/yup.ts: -------------------------------------------------------------------------------- 1 | export interface IYupData { 2 | name: string; 3 | age: number; 4 | email?: string | undefined; 5 | website?: string | null | undefined; 6 | createdOn: Date; 7 | } 8 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/middleware/joi.ts: -------------------------------------------------------------------------------- 1 | import Joi, { ObjectSchema } from 'joi'; 2 | import { NextFunction, Request, Response } from 'express'; 3 | import { IJoiData } from '../interfaces/joi'; 4 | 5 | export const ValidateJoi = (schema: ObjectSchema) => { 6 | return async (req: Request, res: Response, next: NextFunction) => { 7 | try { 8 | await schema.validateAsync(req.body); 9 | 10 | next(); 11 | } catch (error) { 12 | console.error(error); 13 | 14 | return res.status(422).json({ error }); 15 | } 16 | }; 17 | }; 18 | 19 | export const Schemas = { 20 | data: Joi.object({ 21 | username: Joi.string().alphanum().min(3).max(15).required(), 22 | password: Joi.string().pattern(new RegExp('^[a-zA-Z0-9]{3,30}$')).required(), 23 | email: Joi.string() 24 | .email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } }) 25 | .required(), 26 | birth_year: Joi.number().integer().min(1900).max(2013) 27 | }) 28 | }; 29 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/middleware/yup.ts: -------------------------------------------------------------------------------- 1 | import { object, string, number, date, AnyObjectSchema } from 'yup'; 2 | import { NextFunction, Request, Response } from 'express'; 3 | 4 | export const ValidateYup = (schema: AnyObjectSchema) => { 5 | return async (req: Request, res: Response, next: NextFunction) => { 6 | try { 7 | const data = await schema.validate(req.body); 8 | 9 | console.log(data); 10 | 11 | next(); 12 | } catch (error) { 13 | console.error(error); 14 | 15 | return res.status(422).json({ error }); 16 | } 17 | }; 18 | }; 19 | 20 | export const Schemas = { 21 | data: object().shape({ 22 | name: string().required(), 23 | age: number().required().positive().integer(), 24 | email: string().email(), 25 | website: string().url(), 26 | createdOn: date().default(() => new Date()) 27 | }) 28 | }; 29 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/routes/joi.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/joi'; 3 | import { Schemas, ValidateJoi } from '../middleware/joi'; 4 | 5 | const router = express.Router(); 6 | 7 | router.post('/', ValidateJoi(Schemas.data), controller.joiSampleRoute); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/routes/yup.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/yup'; 3 | import { Schemas, ValidateYup } from '../middleware/yup'; 4 | 5 | const router = express.Router(); 6 | 7 | router.post('/', ValidateYup(Schemas.data), controller.yupSampleRoute); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /ValidationByJoiExample/src/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | import express from 'express'; 3 | import joiRoutes from './routes/joi'; 4 | import yupRoutes from './routes/yup'; 5 | 6 | const router = express(); 7 | 8 | /** Log the request */ 9 | router.use((req, res, next) => { 10 | /** Log the req */ 11 | console.info(`METHOD: [${req.method}] - URL: [${req.url}] - IP: [${req.socket.remoteAddress}]`); 12 | 13 | res.on('finish', () => { 14 | /** Log the res */ 15 | console.info(`METHOD: [${req.method}] - URL: [${req.url}] - STATUS: [${res.statusCode}] - IP: [${req.socket.remoteAddress}]`); 16 | }); 17 | 18 | next(); 19 | }); 20 | 21 | router.use(express.urlencoded({ extended: true })); 22 | router.use(express.json()); 23 | 24 | /** Rules of our API */ 25 | router.use((req, res, next) => { 26 | res.header('Access-Control-Allow-Origin', '*'); 27 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); 28 | 29 | if (req.method == 'OPTIONS') { 30 | res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); 31 | return res.status(200).json({}); 32 | } 33 | 34 | next(); 35 | }); 36 | 37 | /** Routes */ 38 | router.use('/joi', joiRoutes); 39 | router.use('/yup', yupRoutes); 40 | 41 | /** Error handling */ 42 | router.use((req, res, next) => { 43 | const error = new Error('Not found'); 44 | 45 | return res.status(404).json({ 46 | message: error.message 47 | }); 48 | }); 49 | 50 | const httpServer = http.createServer(router); 51 | httpServer.listen(1337, () => console.info('Server is running on port 1337 ...')); 52 | -------------------------------------------------------------------------------- /ValidationByJoiExample/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Enable incremental compilation */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ 22 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | 26 | /* Modules */ 27 | "module": "commonjs", /* Specify what module code is generated. */ 28 | // "rootDir": "./", /* Specify the root folder within your source files. */ 29 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 30 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 31 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 32 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 33 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ 34 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 35 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 36 | // "resolveJsonModule": true, /* Enable importing .json files */ 37 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ 38 | 39 | /* JavaScript Support */ 40 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ 41 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 42 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ 43 | 44 | /* Emit */ 45 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 46 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 47 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 48 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 49 | // "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. */ 50 | "outDir": "./build", /* Specify an output folder for all emitted files. */ 51 | // "removeComments": true, /* Disable emitting comments. */ 52 | // "noEmit": true, /* Disable emitting files from a compilation. */ 53 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 54 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ 55 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 56 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 58 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 59 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 60 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 61 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 62 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ 63 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ 64 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 65 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ 66 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 67 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 68 | 69 | /* Interop Constraints */ 70 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 71 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 72 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ 73 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 74 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 75 | 76 | /* Type Checking */ 77 | "strict": true, /* Enable all strict type-checking options. */ 78 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ 79 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ 80 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 81 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ 82 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 83 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ 84 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ 85 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 86 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ 87 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ 88 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 89 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 90 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 91 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 92 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 93 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ 94 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 95 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 96 | 97 | /* Completeness */ 98 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 99 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 100 | }, 101 | "include": ["src/**/*.ts"] 102 | } 103 | -------------------------------------------------------------------------------- /ValidationByYupExample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /node_modules -------------------------------------------------------------------------------- /ValidationByYupExample/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 200, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "useTabs": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "semi": true 11 | } 12 | -------------------------------------------------------------------------------- /ValidationByYupExample/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.bracketPairColorization.enabled": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnPaste": true, 6 | "editor.wordWrap": "on", 7 | "git.ignoreLimitWarning": true 8 | } 9 | -------------------------------------------------------------------------------- /ValidationByYupExample/README.md: -------------------------------------------------------------------------------- 1 | # Restful API Data Validation & Control 2 | 3 | ![N|Solid](https://lh3.googleusercontent.com/a-/AOh14GglnMoBPixoeH-IwaCWx7SpehtvYTPowns21fVO=s200-k-no-rp-mo) 4 | 5 | This repository is a basic example of using various libraries to validate data that is passed to your api. Inside of the middleware folder, you can view each sample routes protection. 6 | 7 | ## License 8 | 9 | MIT 10 | -------------------------------------------------------------------------------- /ValidationByYupExample/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "joi-example", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "joi-example", 9 | "version": "1.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "express": "^4.17.2", 13 | "joi": "^17.5.0", 14 | "yup": "^0.32.11" 15 | }, 16 | "devDependencies": { 17 | "@types/express": "^4.17.13", 18 | "typescript": "^4.5.4" 19 | } 20 | }, 21 | "node_modules/@babel/runtime": { 22 | "version": "7.16.7", 23 | "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", 24 | "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", 25 | "dependencies": { 26 | "regenerator-runtime": "^0.13.4" 27 | }, 28 | "engines": { 29 | "node": ">=6.9.0" 30 | } 31 | }, 32 | "node_modules/@hapi/hoek": { 33 | "version": "9.2.1", 34 | "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz", 35 | "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==" 36 | }, 37 | "node_modules/@hapi/topo": { 38 | "version": "5.1.0", 39 | "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", 40 | "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", 41 | "dependencies": { 42 | "@hapi/hoek": "^9.0.0" 43 | } 44 | }, 45 | "node_modules/@sideway/address": { 46 | "version": "4.1.3", 47 | "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz", 48 | "integrity": "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==", 49 | "dependencies": { 50 | "@hapi/hoek": "^9.0.0" 51 | } 52 | }, 53 | "node_modules/@sideway/formula": { 54 | "version": "3.0.0", 55 | "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", 56 | "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" 57 | }, 58 | "node_modules/@sideway/pinpoint": { 59 | "version": "2.0.0", 60 | "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", 61 | "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" 62 | }, 63 | "node_modules/@types/body-parser": { 64 | "version": "1.19.2", 65 | "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", 66 | "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", 67 | "dev": true, 68 | "dependencies": { 69 | "@types/connect": "*", 70 | "@types/node": "*" 71 | } 72 | }, 73 | "node_modules/@types/connect": { 74 | "version": "3.4.35", 75 | "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", 76 | "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", 77 | "dev": true, 78 | "dependencies": { 79 | "@types/node": "*" 80 | } 81 | }, 82 | "node_modules/@types/express": { 83 | "version": "4.17.13", 84 | "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", 85 | "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", 86 | "dev": true, 87 | "dependencies": { 88 | "@types/body-parser": "*", 89 | "@types/express-serve-static-core": "^4.17.18", 90 | "@types/qs": "*", 91 | "@types/serve-static": "*" 92 | } 93 | }, 94 | "node_modules/@types/express-serve-static-core": { 95 | "version": "4.17.28", 96 | "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", 97 | "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", 98 | "dev": true, 99 | "dependencies": { 100 | "@types/node": "*", 101 | "@types/qs": "*", 102 | "@types/range-parser": "*" 103 | } 104 | }, 105 | "node_modules/@types/lodash": { 106 | "version": "4.14.178", 107 | "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz", 108 | "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==" 109 | }, 110 | "node_modules/@types/mime": { 111 | "version": "1.3.2", 112 | "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", 113 | "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", 114 | "dev": true 115 | }, 116 | "node_modules/@types/node": { 117 | "version": "17.0.13", 118 | "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", 119 | "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==", 120 | "dev": true 121 | }, 122 | "node_modules/@types/qs": { 123 | "version": "6.9.7", 124 | "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", 125 | "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", 126 | "dev": true 127 | }, 128 | "node_modules/@types/range-parser": { 129 | "version": "1.2.4", 130 | "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", 131 | "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", 132 | "dev": true 133 | }, 134 | "node_modules/@types/serve-static": { 135 | "version": "1.13.10", 136 | "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", 137 | "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", 138 | "dev": true, 139 | "dependencies": { 140 | "@types/mime": "^1", 141 | "@types/node": "*" 142 | } 143 | }, 144 | "node_modules/accepts": { 145 | "version": "1.3.7", 146 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 147 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 148 | "dependencies": { 149 | "mime-types": "~2.1.24", 150 | "negotiator": "0.6.2" 151 | }, 152 | "engines": { 153 | "node": ">= 0.6" 154 | } 155 | }, 156 | "node_modules/array-flatten": { 157 | "version": "1.1.1", 158 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 159 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 160 | }, 161 | "node_modules/body-parser": { 162 | "version": "1.19.1", 163 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", 164 | "integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", 165 | "dependencies": { 166 | "bytes": "3.1.1", 167 | "content-type": "~1.0.4", 168 | "debug": "2.6.9", 169 | "depd": "~1.1.2", 170 | "http-errors": "1.8.1", 171 | "iconv-lite": "0.4.24", 172 | "on-finished": "~2.3.0", 173 | "qs": "6.9.6", 174 | "raw-body": "2.4.2", 175 | "type-is": "~1.6.18" 176 | }, 177 | "engines": { 178 | "node": ">= 0.8" 179 | } 180 | }, 181 | "node_modules/bytes": { 182 | "version": "3.1.1", 183 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", 184 | "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", 185 | "engines": { 186 | "node": ">= 0.8" 187 | } 188 | }, 189 | "node_modules/content-disposition": { 190 | "version": "0.5.4", 191 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 192 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 193 | "dependencies": { 194 | "safe-buffer": "5.2.1" 195 | }, 196 | "engines": { 197 | "node": ">= 0.6" 198 | } 199 | }, 200 | "node_modules/content-type": { 201 | "version": "1.0.4", 202 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 203 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", 204 | "engines": { 205 | "node": ">= 0.6" 206 | } 207 | }, 208 | "node_modules/cookie": { 209 | "version": "0.4.1", 210 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", 211 | "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", 212 | "engines": { 213 | "node": ">= 0.6" 214 | } 215 | }, 216 | "node_modules/cookie-signature": { 217 | "version": "1.0.6", 218 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 219 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 220 | }, 221 | "node_modules/debug": { 222 | "version": "2.6.9", 223 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 224 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 225 | "dependencies": { 226 | "ms": "2.0.0" 227 | } 228 | }, 229 | "node_modules/depd": { 230 | "version": "1.1.2", 231 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 232 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", 233 | "engines": { 234 | "node": ">= 0.6" 235 | } 236 | }, 237 | "node_modules/destroy": { 238 | "version": "1.0.4", 239 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 240 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 241 | }, 242 | "node_modules/ee-first": { 243 | "version": "1.1.1", 244 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 245 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 246 | }, 247 | "node_modules/encodeurl": { 248 | "version": "1.0.2", 249 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 250 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", 251 | "engines": { 252 | "node": ">= 0.8" 253 | } 254 | }, 255 | "node_modules/escape-html": { 256 | "version": "1.0.3", 257 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 258 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 259 | }, 260 | "node_modules/etag": { 261 | "version": "1.8.1", 262 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 263 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", 264 | "engines": { 265 | "node": ">= 0.6" 266 | } 267 | }, 268 | "node_modules/express": { 269 | "version": "4.17.2", 270 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", 271 | "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", 272 | "dependencies": { 273 | "accepts": "~1.3.7", 274 | "array-flatten": "1.1.1", 275 | "body-parser": "1.19.1", 276 | "content-disposition": "0.5.4", 277 | "content-type": "~1.0.4", 278 | "cookie": "0.4.1", 279 | "cookie-signature": "1.0.6", 280 | "debug": "2.6.9", 281 | "depd": "~1.1.2", 282 | "encodeurl": "~1.0.2", 283 | "escape-html": "~1.0.3", 284 | "etag": "~1.8.1", 285 | "finalhandler": "~1.1.2", 286 | "fresh": "0.5.2", 287 | "merge-descriptors": "1.0.1", 288 | "methods": "~1.1.2", 289 | "on-finished": "~2.3.0", 290 | "parseurl": "~1.3.3", 291 | "path-to-regexp": "0.1.7", 292 | "proxy-addr": "~2.0.7", 293 | "qs": "6.9.6", 294 | "range-parser": "~1.2.1", 295 | "safe-buffer": "5.2.1", 296 | "send": "0.17.2", 297 | "serve-static": "1.14.2", 298 | "setprototypeof": "1.2.0", 299 | "statuses": "~1.5.0", 300 | "type-is": "~1.6.18", 301 | "utils-merge": "1.0.1", 302 | "vary": "~1.1.2" 303 | }, 304 | "engines": { 305 | "node": ">= 0.10.0" 306 | } 307 | }, 308 | "node_modules/finalhandler": { 309 | "version": "1.1.2", 310 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 311 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 312 | "dependencies": { 313 | "debug": "2.6.9", 314 | "encodeurl": "~1.0.2", 315 | "escape-html": "~1.0.3", 316 | "on-finished": "~2.3.0", 317 | "parseurl": "~1.3.3", 318 | "statuses": "~1.5.0", 319 | "unpipe": "~1.0.0" 320 | }, 321 | "engines": { 322 | "node": ">= 0.8" 323 | } 324 | }, 325 | "node_modules/forwarded": { 326 | "version": "0.2.0", 327 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 328 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", 329 | "engines": { 330 | "node": ">= 0.6" 331 | } 332 | }, 333 | "node_modules/fresh": { 334 | "version": "0.5.2", 335 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 336 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", 337 | "engines": { 338 | "node": ">= 0.6" 339 | } 340 | }, 341 | "node_modules/http-errors": { 342 | "version": "1.8.1", 343 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", 344 | "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", 345 | "dependencies": { 346 | "depd": "~1.1.2", 347 | "inherits": "2.0.4", 348 | "setprototypeof": "1.2.0", 349 | "statuses": ">= 1.5.0 < 2", 350 | "toidentifier": "1.0.1" 351 | }, 352 | "engines": { 353 | "node": ">= 0.6" 354 | } 355 | }, 356 | "node_modules/iconv-lite": { 357 | "version": "0.4.24", 358 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 359 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 360 | "dependencies": { 361 | "safer-buffer": ">= 2.1.2 < 3" 362 | }, 363 | "engines": { 364 | "node": ">=0.10.0" 365 | } 366 | }, 367 | "node_modules/inherits": { 368 | "version": "2.0.4", 369 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 370 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 371 | }, 372 | "node_modules/ipaddr.js": { 373 | "version": "1.9.1", 374 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 375 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", 376 | "engines": { 377 | "node": ">= 0.10" 378 | } 379 | }, 380 | "node_modules/joi": { 381 | "version": "17.6.0", 382 | "resolved": "https://registry.npmjs.org/joi/-/joi-17.6.0.tgz", 383 | "integrity": "sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==", 384 | "dependencies": { 385 | "@hapi/hoek": "^9.0.0", 386 | "@hapi/topo": "^5.0.0", 387 | "@sideway/address": "^4.1.3", 388 | "@sideway/formula": "^3.0.0", 389 | "@sideway/pinpoint": "^2.0.0" 390 | } 391 | }, 392 | "node_modules/lodash": { 393 | "version": "4.17.21", 394 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 395 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" 396 | }, 397 | "node_modules/lodash-es": { 398 | "version": "4.17.21", 399 | "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", 400 | "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" 401 | }, 402 | "node_modules/media-typer": { 403 | "version": "0.3.0", 404 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 405 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", 406 | "engines": { 407 | "node": ">= 0.6" 408 | } 409 | }, 410 | "node_modules/merge-descriptors": { 411 | "version": "1.0.1", 412 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 413 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 414 | }, 415 | "node_modules/methods": { 416 | "version": "1.1.2", 417 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 418 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", 419 | "engines": { 420 | "node": ">= 0.6" 421 | } 422 | }, 423 | "node_modules/mime": { 424 | "version": "1.6.0", 425 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 426 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 427 | "bin": { 428 | "mime": "cli.js" 429 | }, 430 | "engines": { 431 | "node": ">=4" 432 | } 433 | }, 434 | "node_modules/mime-db": { 435 | "version": "1.51.0", 436 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", 437 | "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", 438 | "engines": { 439 | "node": ">= 0.6" 440 | } 441 | }, 442 | "node_modules/mime-types": { 443 | "version": "2.1.34", 444 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", 445 | "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", 446 | "dependencies": { 447 | "mime-db": "1.51.0" 448 | }, 449 | "engines": { 450 | "node": ">= 0.6" 451 | } 452 | }, 453 | "node_modules/ms": { 454 | "version": "2.0.0", 455 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 456 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 457 | }, 458 | "node_modules/nanoclone": { 459 | "version": "0.2.1", 460 | "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", 461 | "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" 462 | }, 463 | "node_modules/negotiator": { 464 | "version": "0.6.2", 465 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 466 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", 467 | "engines": { 468 | "node": ">= 0.6" 469 | } 470 | }, 471 | "node_modules/on-finished": { 472 | "version": "2.3.0", 473 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 474 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 475 | "dependencies": { 476 | "ee-first": "1.1.1" 477 | }, 478 | "engines": { 479 | "node": ">= 0.8" 480 | } 481 | }, 482 | "node_modules/parseurl": { 483 | "version": "1.3.3", 484 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 485 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", 486 | "engines": { 487 | "node": ">= 0.8" 488 | } 489 | }, 490 | "node_modules/path-to-regexp": { 491 | "version": "0.1.7", 492 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 493 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 494 | }, 495 | "node_modules/property-expr": { 496 | "version": "2.0.5", 497 | "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", 498 | "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" 499 | }, 500 | "node_modules/proxy-addr": { 501 | "version": "2.0.7", 502 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 503 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 504 | "dependencies": { 505 | "forwarded": "0.2.0", 506 | "ipaddr.js": "1.9.1" 507 | }, 508 | "engines": { 509 | "node": ">= 0.10" 510 | } 511 | }, 512 | "node_modules/qs": { 513 | "version": "6.9.6", 514 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", 515 | "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", 516 | "engines": { 517 | "node": ">=0.6" 518 | }, 519 | "funding": { 520 | "url": "https://github.com/sponsors/ljharb" 521 | } 522 | }, 523 | "node_modules/range-parser": { 524 | "version": "1.2.1", 525 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 526 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", 527 | "engines": { 528 | "node": ">= 0.6" 529 | } 530 | }, 531 | "node_modules/raw-body": { 532 | "version": "2.4.2", 533 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", 534 | "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", 535 | "dependencies": { 536 | "bytes": "3.1.1", 537 | "http-errors": "1.8.1", 538 | "iconv-lite": "0.4.24", 539 | "unpipe": "1.0.0" 540 | }, 541 | "engines": { 542 | "node": ">= 0.8" 543 | } 544 | }, 545 | "node_modules/regenerator-runtime": { 546 | "version": "0.13.9", 547 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", 548 | "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" 549 | }, 550 | "node_modules/safe-buffer": { 551 | "version": "5.2.1", 552 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 553 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 554 | "funding": [ 555 | { 556 | "type": "github", 557 | "url": "https://github.com/sponsors/feross" 558 | }, 559 | { 560 | "type": "patreon", 561 | "url": "https://www.patreon.com/feross" 562 | }, 563 | { 564 | "type": "consulting", 565 | "url": "https://feross.org/support" 566 | } 567 | ] 568 | }, 569 | "node_modules/safer-buffer": { 570 | "version": "2.1.2", 571 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 572 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 573 | }, 574 | "node_modules/send": { 575 | "version": "0.17.2", 576 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", 577 | "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", 578 | "dependencies": { 579 | "debug": "2.6.9", 580 | "depd": "~1.1.2", 581 | "destroy": "~1.0.4", 582 | "encodeurl": "~1.0.2", 583 | "escape-html": "~1.0.3", 584 | "etag": "~1.8.1", 585 | "fresh": "0.5.2", 586 | "http-errors": "1.8.1", 587 | "mime": "1.6.0", 588 | "ms": "2.1.3", 589 | "on-finished": "~2.3.0", 590 | "range-parser": "~1.2.1", 591 | "statuses": "~1.5.0" 592 | }, 593 | "engines": { 594 | "node": ">= 0.8.0" 595 | } 596 | }, 597 | "node_modules/send/node_modules/ms": { 598 | "version": "2.1.3", 599 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 600 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 601 | }, 602 | "node_modules/serve-static": { 603 | "version": "1.14.2", 604 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", 605 | "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", 606 | "dependencies": { 607 | "encodeurl": "~1.0.2", 608 | "escape-html": "~1.0.3", 609 | "parseurl": "~1.3.3", 610 | "send": "0.17.2" 611 | }, 612 | "engines": { 613 | "node": ">= 0.8.0" 614 | } 615 | }, 616 | "node_modules/setprototypeof": { 617 | "version": "1.2.0", 618 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 619 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 620 | }, 621 | "node_modules/statuses": { 622 | "version": "1.5.0", 623 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 624 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", 625 | "engines": { 626 | "node": ">= 0.6" 627 | } 628 | }, 629 | "node_modules/toidentifier": { 630 | "version": "1.0.1", 631 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 632 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", 633 | "engines": { 634 | "node": ">=0.6" 635 | } 636 | }, 637 | "node_modules/toposort": { 638 | "version": "2.0.2", 639 | "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", 640 | "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=" 641 | }, 642 | "node_modules/type-is": { 643 | "version": "1.6.18", 644 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 645 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 646 | "dependencies": { 647 | "media-typer": "0.3.0", 648 | "mime-types": "~2.1.24" 649 | }, 650 | "engines": { 651 | "node": ">= 0.6" 652 | } 653 | }, 654 | "node_modules/typescript": { 655 | "version": "4.5.5", 656 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", 657 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", 658 | "dev": true, 659 | "bin": { 660 | "tsc": "bin/tsc", 661 | "tsserver": "bin/tsserver" 662 | }, 663 | "engines": { 664 | "node": ">=4.2.0" 665 | } 666 | }, 667 | "node_modules/unpipe": { 668 | "version": "1.0.0", 669 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 670 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", 671 | "engines": { 672 | "node": ">= 0.8" 673 | } 674 | }, 675 | "node_modules/utils-merge": { 676 | "version": "1.0.1", 677 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 678 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", 679 | "engines": { 680 | "node": ">= 0.4.0" 681 | } 682 | }, 683 | "node_modules/vary": { 684 | "version": "1.1.2", 685 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 686 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", 687 | "engines": { 688 | "node": ">= 0.8" 689 | } 690 | }, 691 | "node_modules/yup": { 692 | "version": "0.32.11", 693 | "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", 694 | "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", 695 | "dependencies": { 696 | "@babel/runtime": "^7.15.4", 697 | "@types/lodash": "^4.14.175", 698 | "lodash": "^4.17.21", 699 | "lodash-es": "^4.17.21", 700 | "nanoclone": "^0.2.1", 701 | "property-expr": "^2.0.4", 702 | "toposort": "^2.0.2" 703 | }, 704 | "engines": { 705 | "node": ">=10" 706 | } 707 | } 708 | }, 709 | "dependencies": { 710 | "@babel/runtime": { 711 | "version": "7.16.7", 712 | "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", 713 | "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", 714 | "requires": { 715 | "regenerator-runtime": "^0.13.4" 716 | } 717 | }, 718 | "@hapi/hoek": { 719 | "version": "9.2.1", 720 | "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz", 721 | "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==" 722 | }, 723 | "@hapi/topo": { 724 | "version": "5.1.0", 725 | "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", 726 | "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", 727 | "requires": { 728 | "@hapi/hoek": "^9.0.0" 729 | } 730 | }, 731 | "@sideway/address": { 732 | "version": "4.1.3", 733 | "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz", 734 | "integrity": "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==", 735 | "requires": { 736 | "@hapi/hoek": "^9.0.0" 737 | } 738 | }, 739 | "@sideway/formula": { 740 | "version": "3.0.0", 741 | "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", 742 | "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" 743 | }, 744 | "@sideway/pinpoint": { 745 | "version": "2.0.0", 746 | "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", 747 | "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" 748 | }, 749 | "@types/body-parser": { 750 | "version": "1.19.2", 751 | "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", 752 | "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", 753 | "dev": true, 754 | "requires": { 755 | "@types/connect": "*", 756 | "@types/node": "*" 757 | } 758 | }, 759 | "@types/connect": { 760 | "version": "3.4.35", 761 | "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", 762 | "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", 763 | "dev": true, 764 | "requires": { 765 | "@types/node": "*" 766 | } 767 | }, 768 | "@types/express": { 769 | "version": "4.17.13", 770 | "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", 771 | "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", 772 | "dev": true, 773 | "requires": { 774 | "@types/body-parser": "*", 775 | "@types/express-serve-static-core": "^4.17.18", 776 | "@types/qs": "*", 777 | "@types/serve-static": "*" 778 | } 779 | }, 780 | "@types/express-serve-static-core": { 781 | "version": "4.17.28", 782 | "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", 783 | "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", 784 | "dev": true, 785 | "requires": { 786 | "@types/node": "*", 787 | "@types/qs": "*", 788 | "@types/range-parser": "*" 789 | } 790 | }, 791 | "@types/lodash": { 792 | "version": "4.14.178", 793 | "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz", 794 | "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==" 795 | }, 796 | "@types/mime": { 797 | "version": "1.3.2", 798 | "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", 799 | "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", 800 | "dev": true 801 | }, 802 | "@types/node": { 803 | "version": "17.0.13", 804 | "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", 805 | "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==", 806 | "dev": true 807 | }, 808 | "@types/qs": { 809 | "version": "6.9.7", 810 | "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", 811 | "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", 812 | "dev": true 813 | }, 814 | "@types/range-parser": { 815 | "version": "1.2.4", 816 | "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", 817 | "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", 818 | "dev": true 819 | }, 820 | "@types/serve-static": { 821 | "version": "1.13.10", 822 | "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", 823 | "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", 824 | "dev": true, 825 | "requires": { 826 | "@types/mime": "^1", 827 | "@types/node": "*" 828 | } 829 | }, 830 | "accepts": { 831 | "version": "1.3.7", 832 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 833 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 834 | "requires": { 835 | "mime-types": "~2.1.24", 836 | "negotiator": "0.6.2" 837 | } 838 | }, 839 | "array-flatten": { 840 | "version": "1.1.1", 841 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 842 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 843 | }, 844 | "body-parser": { 845 | "version": "1.19.1", 846 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", 847 | "integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", 848 | "requires": { 849 | "bytes": "3.1.1", 850 | "content-type": "~1.0.4", 851 | "debug": "2.6.9", 852 | "depd": "~1.1.2", 853 | "http-errors": "1.8.1", 854 | "iconv-lite": "0.4.24", 855 | "on-finished": "~2.3.0", 856 | "qs": "6.9.6", 857 | "raw-body": "2.4.2", 858 | "type-is": "~1.6.18" 859 | } 860 | }, 861 | "bytes": { 862 | "version": "3.1.1", 863 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", 864 | "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==" 865 | }, 866 | "content-disposition": { 867 | "version": "0.5.4", 868 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 869 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 870 | "requires": { 871 | "safe-buffer": "5.2.1" 872 | } 873 | }, 874 | "content-type": { 875 | "version": "1.0.4", 876 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 877 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 878 | }, 879 | "cookie": { 880 | "version": "0.4.1", 881 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", 882 | "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" 883 | }, 884 | "cookie-signature": { 885 | "version": "1.0.6", 886 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 887 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 888 | }, 889 | "debug": { 890 | "version": "2.6.9", 891 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 892 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 893 | "requires": { 894 | "ms": "2.0.0" 895 | } 896 | }, 897 | "depd": { 898 | "version": "1.1.2", 899 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 900 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 901 | }, 902 | "destroy": { 903 | "version": "1.0.4", 904 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 905 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 906 | }, 907 | "ee-first": { 908 | "version": "1.1.1", 909 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 910 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 911 | }, 912 | "encodeurl": { 913 | "version": "1.0.2", 914 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 915 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 916 | }, 917 | "escape-html": { 918 | "version": "1.0.3", 919 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 920 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 921 | }, 922 | "etag": { 923 | "version": "1.8.1", 924 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 925 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 926 | }, 927 | "express": { 928 | "version": "4.17.2", 929 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", 930 | "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", 931 | "requires": { 932 | "accepts": "~1.3.7", 933 | "array-flatten": "1.1.1", 934 | "body-parser": "1.19.1", 935 | "content-disposition": "0.5.4", 936 | "content-type": "~1.0.4", 937 | "cookie": "0.4.1", 938 | "cookie-signature": "1.0.6", 939 | "debug": "2.6.9", 940 | "depd": "~1.1.2", 941 | "encodeurl": "~1.0.2", 942 | "escape-html": "~1.0.3", 943 | "etag": "~1.8.1", 944 | "finalhandler": "~1.1.2", 945 | "fresh": "0.5.2", 946 | "merge-descriptors": "1.0.1", 947 | "methods": "~1.1.2", 948 | "on-finished": "~2.3.0", 949 | "parseurl": "~1.3.3", 950 | "path-to-regexp": "0.1.7", 951 | "proxy-addr": "~2.0.7", 952 | "qs": "6.9.6", 953 | "range-parser": "~1.2.1", 954 | "safe-buffer": "5.2.1", 955 | "send": "0.17.2", 956 | "serve-static": "1.14.2", 957 | "setprototypeof": "1.2.0", 958 | "statuses": "~1.5.0", 959 | "type-is": "~1.6.18", 960 | "utils-merge": "1.0.1", 961 | "vary": "~1.1.2" 962 | } 963 | }, 964 | "finalhandler": { 965 | "version": "1.1.2", 966 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 967 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 968 | "requires": { 969 | "debug": "2.6.9", 970 | "encodeurl": "~1.0.2", 971 | "escape-html": "~1.0.3", 972 | "on-finished": "~2.3.0", 973 | "parseurl": "~1.3.3", 974 | "statuses": "~1.5.0", 975 | "unpipe": "~1.0.0" 976 | } 977 | }, 978 | "forwarded": { 979 | "version": "0.2.0", 980 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 981 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" 982 | }, 983 | "fresh": { 984 | "version": "0.5.2", 985 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 986 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 987 | }, 988 | "http-errors": { 989 | "version": "1.8.1", 990 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", 991 | "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", 992 | "requires": { 993 | "depd": "~1.1.2", 994 | "inherits": "2.0.4", 995 | "setprototypeof": "1.2.0", 996 | "statuses": ">= 1.5.0 < 2", 997 | "toidentifier": "1.0.1" 998 | } 999 | }, 1000 | "iconv-lite": { 1001 | "version": "0.4.24", 1002 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 1003 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 1004 | "requires": { 1005 | "safer-buffer": ">= 2.1.2 < 3" 1006 | } 1007 | }, 1008 | "inherits": { 1009 | "version": "2.0.4", 1010 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 1011 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 1012 | }, 1013 | "ipaddr.js": { 1014 | "version": "1.9.1", 1015 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 1016 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 1017 | }, 1018 | "joi": { 1019 | "version": "17.6.0", 1020 | "resolved": "https://registry.npmjs.org/joi/-/joi-17.6.0.tgz", 1021 | "integrity": "sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==", 1022 | "requires": { 1023 | "@hapi/hoek": "^9.0.0", 1024 | "@hapi/topo": "^5.0.0", 1025 | "@sideway/address": "^4.1.3", 1026 | "@sideway/formula": "^3.0.0", 1027 | "@sideway/pinpoint": "^2.0.0" 1028 | } 1029 | }, 1030 | "lodash": { 1031 | "version": "4.17.21", 1032 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 1033 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" 1034 | }, 1035 | "lodash-es": { 1036 | "version": "4.17.21", 1037 | "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", 1038 | "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" 1039 | }, 1040 | "media-typer": { 1041 | "version": "0.3.0", 1042 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 1043 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 1044 | }, 1045 | "merge-descriptors": { 1046 | "version": "1.0.1", 1047 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 1048 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 1049 | }, 1050 | "methods": { 1051 | "version": "1.1.2", 1052 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 1053 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 1054 | }, 1055 | "mime": { 1056 | "version": "1.6.0", 1057 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 1058 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 1059 | }, 1060 | "mime-db": { 1061 | "version": "1.51.0", 1062 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", 1063 | "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" 1064 | }, 1065 | "mime-types": { 1066 | "version": "2.1.34", 1067 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", 1068 | "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", 1069 | "requires": { 1070 | "mime-db": "1.51.0" 1071 | } 1072 | }, 1073 | "ms": { 1074 | "version": "2.0.0", 1075 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1076 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 1077 | }, 1078 | "nanoclone": { 1079 | "version": "0.2.1", 1080 | "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", 1081 | "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" 1082 | }, 1083 | "negotiator": { 1084 | "version": "0.6.2", 1085 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 1086 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 1087 | }, 1088 | "on-finished": { 1089 | "version": "2.3.0", 1090 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 1091 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 1092 | "requires": { 1093 | "ee-first": "1.1.1" 1094 | } 1095 | }, 1096 | "parseurl": { 1097 | "version": "1.3.3", 1098 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 1099 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 1100 | }, 1101 | "path-to-regexp": { 1102 | "version": "0.1.7", 1103 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 1104 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 1105 | }, 1106 | "property-expr": { 1107 | "version": "2.0.5", 1108 | "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", 1109 | "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" 1110 | }, 1111 | "proxy-addr": { 1112 | "version": "2.0.7", 1113 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 1114 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 1115 | "requires": { 1116 | "forwarded": "0.2.0", 1117 | "ipaddr.js": "1.9.1" 1118 | } 1119 | }, 1120 | "qs": { 1121 | "version": "6.9.6", 1122 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", 1123 | "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==" 1124 | }, 1125 | "range-parser": { 1126 | "version": "1.2.1", 1127 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 1128 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 1129 | }, 1130 | "raw-body": { 1131 | "version": "2.4.2", 1132 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", 1133 | "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", 1134 | "requires": { 1135 | "bytes": "3.1.1", 1136 | "http-errors": "1.8.1", 1137 | "iconv-lite": "0.4.24", 1138 | "unpipe": "1.0.0" 1139 | } 1140 | }, 1141 | "regenerator-runtime": { 1142 | "version": "0.13.9", 1143 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", 1144 | "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" 1145 | }, 1146 | "safe-buffer": { 1147 | "version": "5.2.1", 1148 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 1149 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 1150 | }, 1151 | "safer-buffer": { 1152 | "version": "2.1.2", 1153 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1154 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 1155 | }, 1156 | "send": { 1157 | "version": "0.17.2", 1158 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", 1159 | "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", 1160 | "requires": { 1161 | "debug": "2.6.9", 1162 | "depd": "~1.1.2", 1163 | "destroy": "~1.0.4", 1164 | "encodeurl": "~1.0.2", 1165 | "escape-html": "~1.0.3", 1166 | "etag": "~1.8.1", 1167 | "fresh": "0.5.2", 1168 | "http-errors": "1.8.1", 1169 | "mime": "1.6.0", 1170 | "ms": "2.1.3", 1171 | "on-finished": "~2.3.0", 1172 | "range-parser": "~1.2.1", 1173 | "statuses": "~1.5.0" 1174 | }, 1175 | "dependencies": { 1176 | "ms": { 1177 | "version": "2.1.3", 1178 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1179 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 1180 | } 1181 | } 1182 | }, 1183 | "serve-static": { 1184 | "version": "1.14.2", 1185 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", 1186 | "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", 1187 | "requires": { 1188 | "encodeurl": "~1.0.2", 1189 | "escape-html": "~1.0.3", 1190 | "parseurl": "~1.3.3", 1191 | "send": "0.17.2" 1192 | } 1193 | }, 1194 | "setprototypeof": { 1195 | "version": "1.2.0", 1196 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 1197 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 1198 | }, 1199 | "statuses": { 1200 | "version": "1.5.0", 1201 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 1202 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 1203 | }, 1204 | "toidentifier": { 1205 | "version": "1.0.1", 1206 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 1207 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" 1208 | }, 1209 | "toposort": { 1210 | "version": "2.0.2", 1211 | "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", 1212 | "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=" 1213 | }, 1214 | "type-is": { 1215 | "version": "1.6.18", 1216 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 1217 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 1218 | "requires": { 1219 | "media-typer": "0.3.0", 1220 | "mime-types": "~2.1.24" 1221 | } 1222 | }, 1223 | "typescript": { 1224 | "version": "4.5.5", 1225 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", 1226 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", 1227 | "dev": true 1228 | }, 1229 | "unpipe": { 1230 | "version": "1.0.0", 1231 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 1232 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 1233 | }, 1234 | "utils-merge": { 1235 | "version": "1.0.1", 1236 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 1237 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 1238 | }, 1239 | "vary": { 1240 | "version": "1.1.2", 1241 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 1242 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 1243 | }, 1244 | "yup": { 1245 | "version": "0.32.11", 1246 | "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", 1247 | "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", 1248 | "requires": { 1249 | "@babel/runtime": "^7.15.4", 1250 | "@types/lodash": "^4.14.175", 1251 | "lodash": "^4.17.21", 1252 | "lodash-es": "^4.17.21", 1253 | "nanoclone": "^0.2.1", 1254 | "property-expr": "^2.0.4", 1255 | "toposort": "^2.0.2" 1256 | } 1257 | } 1258 | } 1259 | } 1260 | -------------------------------------------------------------------------------- /ValidationByYupExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "joi-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/server.ts", 6 | "scripts": { 7 | "build": "rm -rf build && prettier --write source/ && tsc" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "express": "^4.17.2", 13 | "joi": "^17.5.0", 14 | "yup": "^0.32.11" 15 | }, 16 | "devDependencies": { 17 | "@types/express": "^4.17.13", 18 | "typescript": "^4.5.4" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ValidationByYupExample/src/controllers/yup.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import { IYupData } from '../interfaces/yup'; 3 | 4 | const yupSampleRoute = (req: Request, res: Response, next: NextFunction) => { 5 | return res.status(200).json({ 6 | locals: res.locals.data as IYupData, 7 | body: req.body 8 | }); 9 | }; 10 | 11 | export default { yupSampleRoute }; 12 | -------------------------------------------------------------------------------- /ValidationByYupExample/src/interfaces/yup.ts: -------------------------------------------------------------------------------- 1 | export interface IYupData { 2 | name: string; 3 | age: number; 4 | email?: string | undefined; 5 | website?: string | null | undefined; 6 | createdOn: Date; 7 | } 8 | -------------------------------------------------------------------------------- /ValidationByYupExample/src/middleware/yup.ts: -------------------------------------------------------------------------------- 1 | import { object, string, number, date, AnyObjectSchema } from 'yup'; 2 | import { NextFunction, Request, Response } from 'express'; 3 | 4 | export const ValidateYup = (schema: AnyObjectSchema) => { 5 | return async (req: Request, res: Response, next: NextFunction) => { 6 | try { 7 | const data = await schema.validate(req.body); 8 | 9 | console.log(data); 10 | 11 | res.locals.data = data; 12 | 13 | next(); 14 | } catch (error) { 15 | console.error(error); 16 | 17 | return res.status(422).json({ error }); 18 | } 19 | }; 20 | }; 21 | 22 | export const Schemas = { 23 | data: object().shape({ 24 | name: string().required(), 25 | age: number().required().positive().integer(), 26 | email: string().email(), 27 | website: string().url(), 28 | createdOn: date().default(() => new Date()) 29 | }) 30 | }; 31 | -------------------------------------------------------------------------------- /ValidationByYupExample/src/routes/yup.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/yup'; 3 | import { Schemas, ValidateYup } from '../middleware/yup'; 4 | 5 | const router = express.Router(); 6 | 7 | router.post('/', ValidateYup(Schemas.data), controller.yupSampleRoute); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /ValidationByYupExample/src/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | import express from 'express'; 3 | import yupRoutes from './routes/yup'; 4 | 5 | const router = express(); 6 | 7 | /** Log the request */ 8 | router.use((req, res, next) => { 9 | /** Log the req */ 10 | console.info(`METHOD: [${req.method}] - URL: [${req.url}] - IP: [${req.socket.remoteAddress}]`); 11 | 12 | res.on('finish', () => { 13 | /** Log the res */ 14 | console.info(`METHOD: [${req.method}] - URL: [${req.url}] - STATUS: [${res.statusCode}] - IP: [${req.socket.remoteAddress}]`); 15 | }); 16 | 17 | next(); 18 | }); 19 | 20 | router.use(express.urlencoded({ extended: true })); 21 | router.use(express.json()); 22 | 23 | /** Rules of our API */ 24 | router.use((req, res, next) => { 25 | res.header('Access-Control-Allow-Origin', '*'); 26 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); 27 | 28 | if (req.method == 'OPTIONS') { 29 | res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); 30 | return res.status(200).json({}); 31 | } 32 | 33 | next(); 34 | }); 35 | 36 | /** Routes */ 37 | router.use('/yup', yupRoutes); 38 | 39 | /** Error handling */ 40 | router.use((req, res, next) => { 41 | const error = new Error('Not found'); 42 | 43 | return res.status(404).json({ 44 | message: error.message 45 | }); 46 | }); 47 | 48 | const httpServer = http.createServer(router); 49 | httpServer.listen(1337, () => console.info('Server is running on port 1337 ...')); 50 | -------------------------------------------------------------------------------- /ValidationByYupExample/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Enable incremental compilation */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ 22 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | 26 | /* Modules */ 27 | "module": "commonjs", /* Specify what module code is generated. */ 28 | // "rootDir": "./", /* Specify the root folder within your source files. */ 29 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 30 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 31 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 32 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 33 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ 34 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 35 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 36 | // "resolveJsonModule": true, /* Enable importing .json files */ 37 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ 38 | 39 | /* JavaScript Support */ 40 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ 41 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 42 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ 43 | 44 | /* Emit */ 45 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 46 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 47 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 48 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 49 | // "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. */ 50 | "outDir": "./build", /* Specify an output folder for all emitted files. */ 51 | // "removeComments": true, /* Disable emitting comments. */ 52 | // "noEmit": true, /* Disable emitting files from a compilation. */ 53 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 54 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ 55 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 56 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 58 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 59 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 60 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 61 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 62 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ 63 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ 64 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 65 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ 66 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 67 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 68 | 69 | /* Interop Constraints */ 70 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 71 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 72 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ 73 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 74 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 75 | 76 | /* Type Checking */ 77 | "strict": true, /* Enable all strict type-checking options. */ 78 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ 79 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ 80 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 81 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ 82 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 83 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ 84 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ 85 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 86 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ 87 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ 88 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 89 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 90 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 91 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 92 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 93 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ 94 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 95 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 96 | 97 | /* Completeness */ 98 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 99 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 100 | }, 101 | "include": ["src/**/*.ts"] 102 | } 103 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # NodeJS Typescript Quickstart Projects 2 | 3 | ![N|Solid](https://lh3.googleusercontent.com/a-/AOh14GglnMoBPixoeH-IwaCWx7SpehtvYTPowns21fVO=s200-k-no-rp-mo) 4 | 5 | [![GitHub stars](https://img.shields.io/github/stars/joeythelantern/Typescript-Quickstart-Projects.svg)](https://github.com/joeythelantern/Typescript-Quickstart-Projects/stargazers) 6 | [![GitHub license](https://img.shields.io/github/license/joeythelantern/Typescript-Quickstart-Projects.svg)](https://github.com/joeythelantern/Typescript-Quickstart-Projects/blob/master/LICENCE) 7 | [![GitHub forks](https://img.shields.io/github/forks/joeythelantern/Typescript-Quickstart-Projects.svg)](https://github.com/joeythelantern/Typescript-Quickstart-Projects/network) 8 | [![Youtube_Channel_Views](https://img.shields.io/youtube/channel/views/UCmG1UbEI0iFE1tAw2SyvvXg?label=Channel%20Views&style=social.svg)](https://img.shields.io/youtube/channel/views/UCmG1UbEI0iFE1tAw2SyvvXg?label=Channel%20Views&style=social) 9 | 10 | Hey everyone! This repository is a 3 in 1 boilerplate that gives you some basic examples of creating a RESTful API in NodeJS, Express, Typescript and an optional database interaction with either MySQL or Mongo. This repository contains 3 folders. Here is a breif description of each, along with a link to a youtube video that will help you code it out yourself: 11 | 12 | - typescript-express-nodejs-quickstart 13 | - Stats: ![N|Solid](https://img.shields.io/youtube/views/vyz47fUXcxU?style=social.svg) ![N|Solid](https://img.shields.io/youtube/likes/vyz47fUXcxU?style=social.svg) 14 | - A basic boilerplate wwith a sample route and controller. 15 | - [https://youtu.be/vyz47fUXcxU](https://youtu.be/vyz47fUXcxU) 16 | - typescript-mongoose-quickstart 17 | - Stats: ![N|Solid](https://img.shields.io/youtube/views/lNqaQ0wEeAo?style=social.svg) ![N|Solid](https://img.shields.io/youtube/likes/lNqaQ0wEeAo?style=social.svg) 18 | - The same boilerplate with a sample MongoDB connection. 19 | - [https://youtu.be/lNqaQ0wEeAo](https://youtu.be/lNqaQ0wEeAo) 20 | - typescript-mysql-quickstart 21 | - Stats: ![N|Solid](https://img.shields.io/youtube/views/eTRSl1As83A?style=social.svg) ![N|Solid](https://img.shields.io/youtube/likes/eTRSl1As83A?style=social.svg) 22 | - Similar to the Mongo project, but with a custom mysql promise adapter. 23 | - [https://youtu.be/eTRSl1As83A](https://youtu.be/eTRSl1As83A) 24 | - ValidationByJoiExample 25 | - Stats: ![N|Solid](https://img.shields.io/youtube/views/J5u9kXnPn8U?style=social.svg) ![N|Solid](https://img.shields.io/youtube/likes/J5u9kXnPn8U?style=social.svg) 26 | - Protect your API and validate your data using JOI. 27 | - [https://youtu.be/J5u9kXnPn8U](https://youtu.be/J5u9kXnPn8U) 28 | - ValidationByYupExample 29 | - Stats: ![N|Solid](https://img.shields.io/youtube/views/JgZ3RWcI3pk?style=social.svg) ![N|Solid](https://img.shields.io/youtube/likes/JgZ3RWcI3pk?style=social.svg) 30 | - Protect your API and validate your data using YUP. 31 | - [https://youtu.be/J5u9kXnPn8U](https://youtu.be/JgZ3RWcI3pk) 32 | 33 | Periodic updates may happen to this repo to make small bug fixes or improvements. Feel free to fork this repository and code away. 34 | 35 | # Updates / Bug Fixes 36 | * 01/23/2021 - Adding MIT Licesnse 37 | * 01/16/2020 - Fixing logging & logging the end of the request properly 38 | 39 | ### Installation 40 | 41 | Install the dependencies and start the server. When you clonse the respository, cd into it and cd into one of the directories to start. Whichever one you pick is where you will run the following commands below. is the directory you've chosen. 42 | 43 | ```sh 44 | $ cd 45 | $ npm install 46 | ``` 47 | 48 | License 49 | ---- 50 | MIT 51 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | build/**/* 3 | certs/**/* 4 | 5 | *.jks 6 | *.p8 7 | *.p12 8 | *.key 9 | *.mobileprovision 10 | *.orig.* 11 | 12 | package-lock.json -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 200, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "useTabs": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "semi": true 11 | } -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.bracketPairColorization.enabled": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnPaste": true, 6 | "editor.wordWrap": "on" 7 | } 8 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "source/server.ts", 6 | "scripts": { 7 | "build": "rm -rf build && prettier --write source/ && tsc" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.19.0", 13 | "dotenv": "^8.2.0", 14 | "express": "^4.17.1" 15 | }, 16 | "devDependencies": { 17 | "@types/body-parser": "^1.19.0", 18 | "@types/dotenv": "^8.2.0", 19 | "@types/express": "^4.17.8" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/source/config/config.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | 3 | dotenv.config(); 4 | 5 | const SERVER_HOSTNAME = process.env.SERVER_HOSTNAME || 'localhost'; 6 | const SERVER_PORT = process.env.SERVER_PORT || 1337; 7 | 8 | const SERVER = { 9 | hostname: SERVER_HOSTNAME, 10 | port: SERVER_PORT 11 | }; 12 | 13 | const config = { 14 | server: SERVER 15 | }; 16 | 17 | export default config; 18 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/source/config/logging.ts: -------------------------------------------------------------------------------- 1 | const info = (namespace: string, message: string, object?: any) => { 2 | if (object) { 3 | console.info(`[${getTimeStamp()}] [INFO] [${namespace}] ${message}`, object); 4 | } else { 5 | console.info(`[${getTimeStamp()}] [INFO] [${namespace}] ${message}`); 6 | } 7 | }; 8 | 9 | const warn = (namespace: string, message: string, object?: any) => { 10 | if (object) { 11 | console.warn(`[${getTimeStamp()}] [WARN] [${namespace}] ${message}`, object); 12 | } else { 13 | console.warn(`[${getTimeStamp()}] [WARN] [${namespace}] ${message}`); 14 | } 15 | }; 16 | 17 | const error = (namespace: string, message: string, object?: any) => { 18 | if (object) { 19 | console.error(`[${getTimeStamp()}] [ERROR] [${namespace}] ${message}`, object); 20 | } else { 21 | console.error(`[${getTimeStamp()}] [ERROR] [${namespace}] ${message}`); 22 | } 23 | }; 24 | 25 | const debug = (namespace: string, message: string, object?: any) => { 26 | if (object) { 27 | console.debug(`[${getTimeStamp()}] [DEBUG] [${namespace}] ${message}`, object); 28 | } else { 29 | console.debug(`[${getTimeStamp()}] [DEBUG] [${namespace}] ${message}`); 30 | } 31 | }; 32 | 33 | const getTimeStamp = (): string => { 34 | return new Date().toISOString(); 35 | }; 36 | 37 | export default { 38 | info, 39 | warn, 40 | error, 41 | debug 42 | }; 43 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/source/controllers/sample.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | 3 | const serverHealthCheck = (req: Request, res: Response, next: NextFunction) => { 4 | return res.status(200).json({ 5 | message: 'pong' 6 | }); 7 | }; 8 | 9 | export default { serverHealthCheck }; 10 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/source/routes/sample.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/sample'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/ping', controller.serverHealthCheck); 7 | 8 | export = router; 9 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/source/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | import bodyParser from 'body-parser'; 3 | import express from 'express'; 4 | import logging from './config/logging'; 5 | import config from './config/config'; 6 | import sampleRoutes from './routes/sample'; 7 | 8 | const NAMESPACE = 'Server'; 9 | const router = express(); 10 | 11 | /** Log the request */ 12 | router.use((req, res, next) => { 13 | /** Log the req */ 14 | logging.info(NAMESPACE, `METHOD: [${req.method}] - URL: [${req.url}] - IP: [${req.socket.remoteAddress}]`); 15 | 16 | res.on('finish', () => { 17 | /** Log the res */ 18 | logging.info(NAMESPACE, `METHOD: [${req.method}] - URL: [${req.url}] - STATUS: [${res.statusCode}] - IP: [${req.socket.remoteAddress}]`); 19 | }) 20 | 21 | next(); 22 | }); 23 | 24 | /** Parse the body of the request */ 25 | router.use(bodyParser.urlencoded({ extended: true })); 26 | router.use(bodyParser.json()); 27 | 28 | /** Rules of our API */ 29 | router.use((req, res, next) => { 30 | res.header('Access-Control-Allow-Origin', '*'); 31 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); 32 | 33 | if (req.method == 'OPTIONS') { 34 | res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); 35 | return res.status(200).json({}); 36 | } 37 | 38 | next(); 39 | }); 40 | 41 | /** Routes go here */ 42 | router.use('/api/sample', sampleRoutes); 43 | 44 | /** Error handling */ 45 | router.use((req, res, next) => { 46 | const error = new Error('Not found'); 47 | 48 | res.status(404).json({ 49 | message: error.message 50 | }); 51 | }); 52 | 53 | const httpServer = http.createServer(router); 54 | 55 | httpServer.listen(config.server.port, () => logging.info(NAMESPACE, `Server is running ${config.server.hostname}:${config.server.port}`)); 56 | -------------------------------------------------------------------------------- /typescript-express-nodejs-quickstart/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | 5 | /* Basic Options */ 6 | // "incremental": true, /* Enable incremental compilation */ 7 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 8 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 9 | // "lib": [], /* Specify library files to be included in the compilation. */ 10 | // "allowJs": true, /* Allow javascript files to be compiled. */ 11 | // "checkJs": true, /* Report errors in .js files. */ 12 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 13 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 14 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 15 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 16 | // "outFile": "./", /* Concatenate and emit output to single file. */ 17 | "outDir": "./build", /* Redirect output structure to the directory. */ 18 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 19 | // "composite": true, /* Enable project compilation */ 20 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 21 | // "removeComments": true, /* Do not emit comments to output. */ 22 | // "noEmit": true, /* Do not emit outputs. */ 23 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 24 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 25 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 26 | 27 | /* Strict Type-Checking Options */ 28 | "strict": true, /* Enable all strict type-checking options. */ 29 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 30 | // "strictNullChecks": true, /* Enable strict null checks. */ 31 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 32 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 33 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 34 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 35 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 36 | 37 | /* Additional Checks */ 38 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 39 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 40 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 41 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 42 | 43 | /* Module Resolution Options */ 44 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 45 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 46 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 47 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 48 | // "typeRoots": [], /* List of folders to include type definitions from. */ 49 | // "types": [], /* Type declaration files to be included in compilation. */ 50 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 51 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 52 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 53 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 54 | 55 | /* Source Map Options */ 56 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 58 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 59 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 60 | 61 | /* Experimental Options */ 62 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 63 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 64 | 65 | /* Advanced Options */ 66 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 67 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | build/**/* 3 | certs/**/* 4 | 5 | *.jks 6 | *.p8 7 | *.p12 8 | *.key 9 | *.mobileprovision 10 | *.orig.* 11 | 12 | package-lock.json -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 200, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "useTabs": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "semi": true 11 | } -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.bracketPairColorization.enabled": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnPaste": true, 6 | "editor.wordWrap": "on" 7 | } 8 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "source/server.ts", 6 | "scripts": { 7 | "build": "rm -rf build && prettier --write source/ && tsc" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.19.0", 13 | "dotenv": "^8.2.0", 14 | "express": "^4.17.1", 15 | "mongoose": "^5.10.15" 16 | }, 17 | "devDependencies": { 18 | "@types/body-parser": "^1.19.0", 19 | "@types/dotenv": "^8.2.0", 20 | "@types/express": "^4.17.8", 21 | "@types/mongoose": "^5.10.1" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/config/config.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | 3 | dotenv.config(); 4 | 5 | const MONGO_OPTIONS = { 6 | useUnifiedTopology: true, 7 | useNewUrlParser: true, 8 | socketTimeoutMS: 30000, 9 | keepAlive: true, 10 | poolSize: 50, 11 | autoIndex: false, 12 | retryWrites: false 13 | }; 14 | 15 | const MONGO_USERNAME = process.env.MONGO_USERNAME || 'superuser'; 16 | const MONGO_PASSWORD = process.env.MONGO_USERNAME || 'supersecretpassword1'; 17 | const MONGO_HOST = process.env.MONGO_URL || `ds343895.mlab.com:43895/mongobongo`; 18 | 19 | const MONGO = { 20 | host: MONGO_HOST, 21 | password: MONGO_PASSWORD, 22 | username: MONGO_USERNAME, 23 | options: MONGO_OPTIONS, 24 | url: `mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOST}` 25 | }; 26 | 27 | const SERVER_HOSTNAME = process.env.SERVER_HOSTNAME || 'localhost'; 28 | const SERVER_PORT = process.env.SERVER_PORT || 1337; 29 | 30 | const SERVER = { 31 | hostname: SERVER_HOSTNAME, 32 | port: SERVER_PORT 33 | }; 34 | 35 | const config = { 36 | mongo: MONGO, 37 | server: SERVER 38 | }; 39 | 40 | export default config; 41 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/config/logging.ts: -------------------------------------------------------------------------------- 1 | const info = (namespace: string, message: string, object?: any) => { 2 | if (object) { 3 | console.info(`[${getTimeStamp()}] [INFO] [${namespace}] ${message}`, object); 4 | } else { 5 | console.info(`[${getTimeStamp()}] [INFO] [${namespace}] ${message}`); 6 | } 7 | }; 8 | 9 | const warn = (namespace: string, message: string, object?: any) => { 10 | if (object) { 11 | console.warn(`[${getTimeStamp()}] [WARN] [${namespace}] ${message}`, object); 12 | } else { 13 | console.warn(`[${getTimeStamp()}] [WARN] [${namespace}] ${message}`); 14 | } 15 | }; 16 | 17 | const error = (namespace: string, message: string, object?: any) => { 18 | if (object) { 19 | console.error(`[${getTimeStamp()}] [ERROR] [${namespace}] ${message}`, object); 20 | } else { 21 | console.error(`[${getTimeStamp()}] [ERROR] [${namespace}] ${message}`); 22 | } 23 | }; 24 | 25 | const debug = (namespace: string, message: string, object?: any) => { 26 | if (object) { 27 | console.debug(`[${getTimeStamp()}] [DEBUG] [${namespace}] ${message}`, object); 28 | } else { 29 | console.debug(`[${getTimeStamp()}] [DEBUG] [${namespace}] ${message}`); 30 | } 31 | }; 32 | 33 | const getTimeStamp = (): string => { 34 | return new Date().toISOString(); 35 | }; 36 | 37 | export default { 38 | info, 39 | warn, 40 | error, 41 | debug 42 | }; 43 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/controllers/book.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import mongoose from 'mongoose'; 3 | import Book from '../models/book'; 4 | 5 | const createBook = (req: Request, res: Response, next: NextFunction) => { 6 | let { author, title } = req.body; 7 | 8 | const book = new Book({ 9 | _id: new mongoose.Types.ObjectId(), 10 | author, 11 | title 12 | }); 13 | 14 | return book 15 | .save() 16 | .then((result) => { 17 | return res.status(201).json({ 18 | book: result 19 | }); 20 | }) 21 | .catch((error) => { 22 | return res.status(500).json({ 23 | message: error.message, 24 | error 25 | }); 26 | }); 27 | }; 28 | 29 | const getAllBooks = (req: Request, res: Response, next: NextFunction) => { 30 | Book.find() 31 | .exec() 32 | .then((books) => { 33 | return res.status(200).json({ 34 | books: books, 35 | count: books.length 36 | }); 37 | }) 38 | .catch((error) => { 39 | return res.status(500).json({ 40 | message: error.message, 41 | error 42 | }); 43 | }); 44 | }; 45 | 46 | export default { createBook, getAllBooks }; 47 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/interfaces/book.ts: -------------------------------------------------------------------------------- 1 | import { Document } from 'mongoose'; 2 | 3 | export default interface IBook extends Document { 4 | title: string; 5 | author: string; 6 | } 7 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/models/book.ts: -------------------------------------------------------------------------------- 1 | import mongoose, { Schema } from 'mongoose'; 2 | import logging from '../config/logging'; 3 | import IBook from '../interfaces/book'; 4 | 5 | const BookSchema: Schema = new Schema( 6 | { 7 | title: { type: String, required: true }, 8 | author: { type: String, required: true } 9 | }, 10 | { 11 | timestamps: true 12 | } 13 | ); 14 | 15 | BookSchema.post('save', function () { 16 | logging.info('Mongo', 'Checkout the book we just saved: ', this); 17 | }); 18 | 19 | export default mongoose.model('Book', BookSchema); 20 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/routes/book.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/book'; 3 | 4 | const router = express.Router(); 5 | 6 | router.post('/create/book', controller.createBook); 7 | router.get('/get/books', controller.getAllBooks); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/source/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | import bodyParser from 'body-parser'; 3 | import express from 'express'; 4 | import logging from './config/logging'; 5 | import config from './config/config'; 6 | import bookRoutes from './routes/book'; 7 | import mongoose from 'mongoose'; 8 | 9 | const NAMESPACE = 'Server'; 10 | const router = express(); 11 | 12 | /** Connect to Mongo */ 13 | mongoose 14 | .connect(config.mongo.url, config.mongo.options) 15 | .then((result) => { 16 | logging.info(NAMESPACE, 'Mongo Connected'); 17 | }) 18 | .catch((error) => { 19 | logging.error(NAMESPACE, error.message, error); 20 | }); 21 | 22 | /** Log the request */ 23 | router.use((req, res, next) => { 24 | /** Log the req */ 25 | logging.info(NAMESPACE, `METHOD: [${req.method}] - URL: [${req.url}] - IP: [${req.socket.remoteAddress}]`); 26 | 27 | res.on('finish', () => { 28 | /** Log the res */ 29 | logging.info(NAMESPACE, `METHOD: [${req.method}] - URL: [${req.url}] - STATUS: [${res.statusCode}] - IP: [${req.socket.remoteAddress}]`); 30 | }) 31 | 32 | next(); 33 | }); 34 | 35 | /** Parse the body of the request */ 36 | router.use(bodyParser.urlencoded({ extended: true })); 37 | router.use(bodyParser.json()); 38 | 39 | /** Rules of our API */ 40 | router.use((req, res, next) => { 41 | res.header('Access-Control-Allow-Origin', '*'); 42 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); 43 | 44 | if (req.method == 'OPTIONS') { 45 | res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); 46 | return res.status(200).json({}); 47 | } 48 | 49 | next(); 50 | }); 51 | 52 | /** Routes go here */ 53 | router.use('/api/books', bookRoutes); 54 | 55 | /** Error handling */ 56 | router.use((req, res, next) => { 57 | const error = new Error('Not found'); 58 | 59 | res.status(404).json({ 60 | message: error.message 61 | }); 62 | }); 63 | 64 | const httpServer = http.createServer(router); 65 | 66 | httpServer.listen(config.server.port, () => logging.info(NAMESPACE, `Server is running ${config.server.hostname}:${config.server.port}`)); 67 | -------------------------------------------------------------------------------- /typescript-mongoose-quickstart/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | 5 | /* Basic Options */ 6 | // "incremental": true, /* Enable incremental compilation */ 7 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 8 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 9 | // "lib": [], /* Specify library files to be included in the compilation. */ 10 | // "allowJs": true, /* Allow javascript files to be compiled. */ 11 | // "checkJs": true, /* Report errors in .js files. */ 12 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 13 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 14 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 15 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 16 | // "outFile": "./", /* Concatenate and emit output to single file. */ 17 | "outDir": "./build", /* Redirect output structure to the directory. */ 18 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 19 | // "composite": true, /* Enable project compilation */ 20 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 21 | // "removeComments": true, /* Do not emit comments to output. */ 22 | // "noEmit": true, /* Do not emit outputs. */ 23 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 24 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 25 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 26 | 27 | /* Strict Type-Checking Options */ 28 | "strict": true, /* Enable all strict type-checking options. */ 29 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 30 | // "strictNullChecks": true, /* Enable strict null checks. */ 31 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 32 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 33 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 34 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 35 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 36 | 37 | /* Additional Checks */ 38 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 39 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 40 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 41 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 42 | 43 | /* Module Resolution Options */ 44 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 45 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 46 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 47 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 48 | // "typeRoots": [], /* List of folders to include type definitions from. */ 49 | // "types": [], /* Type declaration files to be included in compilation. */ 50 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 51 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 52 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 53 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 54 | 55 | /* Source Map Options */ 56 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 58 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 59 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 60 | 61 | /* Experimental Options */ 62 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 63 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 64 | 65 | /* Advanced Options */ 66 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 67 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | build/**/* 3 | certs/**/* 4 | 5 | *.jks 6 | *.p8 7 | *.p12 8 | *.key 9 | *.mobileprovision 10 | *.orig.* 11 | 12 | package-lock.json -------------------------------------------------------------------------------- /typescript-mysql-quickstart/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 200, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "useTabs": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "semi": true 11 | } -------------------------------------------------------------------------------- /typescript-mysql-quickstart/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.bracketPairColorization.enabled": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnPaste": true, 6 | "editor.wordWrap": "on" 7 | } 8 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "source/server.ts", 6 | "scripts": { 7 | "build": "rm -rf build && prettier --write source/ && tsc" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.19.0", 13 | "dotenv": "^8.2.0", 14 | "express": "^4.17.1", 15 | "mysql": "^2.18.1" 16 | }, 17 | "devDependencies": { 18 | "@types/body-parser": "^1.19.0", 19 | "@types/dotenv": "^8.2.0", 20 | "@types/express": "^4.17.8", 21 | "@types/mysql": "^2.15.16" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/config/config.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | 3 | dotenv.config(); 4 | 5 | const MYSQL_HOST = process.env.MYSQL_HOST || 'localhost'; 6 | const MYSQL_DATABASE = process.env.MYSQL_DATABASE || 'supercooldb'; 7 | const MYSQL_USER = process.env.MYSQL_HOST || 'superuser'; 8 | const MYSQL_PASS = process.env.MYSQL_HOST || 'roseville'; 9 | 10 | const MYSQL = { 11 | host: MYSQL_HOST, 12 | database: MYSQL_DATABASE, 13 | user: MYSQL_USER, 14 | pass: MYSQL_PASS 15 | }; 16 | 17 | const SERVER_HOSTNAME = process.env.SERVER_HOSTNAME || 'localhost'; 18 | const SERVER_PORT = process.env.SERVER_PORT || 1337; 19 | 20 | const SERVER = { 21 | hostname: SERVER_HOSTNAME, 22 | port: SERVER_PORT 23 | }; 24 | 25 | const config = { 26 | mysql: MYSQL, 27 | server: SERVER 28 | }; 29 | 30 | export default config; 31 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/config/logging.ts: -------------------------------------------------------------------------------- 1 | const info = (namespace: string, message: string, object?: any) => { 2 | if (object) { 3 | console.info(`[${getTimeStamp()}] [INFO] [${namespace}] ${message}`, object); 4 | } else { 5 | console.info(`[${getTimeStamp()}] [INFO] [${namespace}] ${message}`); 6 | } 7 | }; 8 | 9 | const warn = (namespace: string, message: string, object?: any) => { 10 | if (object) { 11 | console.warn(`[${getTimeStamp()}] [WARN] [${namespace}] ${message}`, object); 12 | } else { 13 | console.warn(`[${getTimeStamp()}] [WARN] [${namespace}] ${message}`); 14 | } 15 | }; 16 | 17 | const error = (namespace: string, message: string, object?: any) => { 18 | if (object) { 19 | console.error(`[${getTimeStamp()}] [ERROR] [${namespace}] ${message}`, object); 20 | } else { 21 | console.error(`[${getTimeStamp()}] [ERROR] [${namespace}] ${message}`); 22 | } 23 | }; 24 | 25 | const debug = (namespace: string, message: string, object?: any) => { 26 | if (object) { 27 | console.debug(`[${getTimeStamp()}] [DEBUG] [${namespace}] ${message}`, object); 28 | } else { 29 | console.debug(`[${getTimeStamp()}] [DEBUG] [${namespace}] ${message}`); 30 | } 31 | }; 32 | 33 | const getTimeStamp = (): string => { 34 | return new Date().toISOString(); 35 | }; 36 | 37 | export default { 38 | info, 39 | warn, 40 | error, 41 | debug 42 | }; 43 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/config/mysql.ts: -------------------------------------------------------------------------------- 1 | import mysql from 'mysql'; 2 | import config from './config'; 3 | 4 | const params = { 5 | user: config.mysql.user, 6 | password: config.mysql.pass, 7 | host: config.mysql.host, 8 | database: config.mysql.database 9 | }; 10 | 11 | const Connect = async () => 12 | new Promise((resolve, reject) => { 13 | const connection = mysql.createConnection(params); 14 | 15 | connection.connect((error) => { 16 | if (error) { 17 | reject(error); 18 | return; 19 | } 20 | 21 | resolve(connection); 22 | }); 23 | }); 24 | 25 | const Query = async (connection: mysql.Connection, query: string) => 26 | new Promise((resolve, reject) => { 27 | connection.query(query, connection, (error, result) => { 28 | if (error) { 29 | reject(error); 30 | return; 31 | } 32 | 33 | resolve(result); 34 | }); 35 | }); 36 | 37 | export { Connect, Query }; 38 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/controllers/book.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import logging from '../config/logging'; 3 | import { Connect, Query } from '../config/mysql'; 4 | 5 | const NAMESPACE = 'Books'; 6 | 7 | const createBook = async (req: Request, res: Response, next: NextFunction) => { 8 | logging.info(NAMESPACE, 'Inserting books'); 9 | 10 | let { author, title } = req.body; 11 | 12 | let query = `INSERT INTO books (author, title) VALUES ("${author}", "${title}")`; 13 | 14 | Connect() 15 | .then((connection) => { 16 | Query(connection, query) 17 | .then((result) => { 18 | logging.info(NAMESPACE, 'Book created: ', result); 19 | 20 | return res.status(200).json({ 21 | result 22 | }); 23 | }) 24 | .catch((error) => { 25 | logging.error(NAMESPACE, error.message, error); 26 | 27 | return res.status(200).json({ 28 | message: error.message, 29 | error 30 | }); 31 | }) 32 | .finally(() => { 33 | logging.info(NAMESPACE, 'Closing connection.'); 34 | connection.end(); 35 | }); 36 | }) 37 | .catch((error) => { 38 | logging.error(NAMESPACE, error.message, error); 39 | 40 | return res.status(200).json({ 41 | message: error.message, 42 | error 43 | }); 44 | }); 45 | }; 46 | 47 | const getAllBooks = async (req: Request, res: Response, next: NextFunction) => { 48 | logging.info(NAMESPACE, 'Getting all books.'); 49 | 50 | let query = 'SELECT * FROM books'; 51 | 52 | Connect() 53 | .then((connection) => { 54 | Query(connection, query) 55 | .then((results) => { 56 | logging.info(NAMESPACE, 'Retrieved books: ', results); 57 | 58 | return res.status(200).json({ 59 | results 60 | }); 61 | }) 62 | .catch((error) => { 63 | logging.error(NAMESPACE, error.message, error); 64 | 65 | return res.status(200).json({ 66 | message: error.message, 67 | error 68 | }); 69 | }) 70 | .finally(() => { 71 | logging.info(NAMESPACE, 'Closing connection.'); 72 | connection.end(); 73 | }); 74 | }) 75 | .catch((error) => { 76 | logging.error(NAMESPACE, error.message, error); 77 | 78 | return res.status(200).json({ 79 | message: error.message, 80 | error 81 | }); 82 | }); 83 | }; 84 | 85 | export default { createBook, getAllBooks }; 86 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/interfaces/book.ts: -------------------------------------------------------------------------------- 1 | export default interface IBook { 2 | id: number; 3 | author: string; 4 | title: string; 5 | } 6 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/routes/book.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import controller from '../controllers/book'; 3 | 4 | const router = express.Router(); 5 | 6 | router.post('/create/book', controller.createBook); 7 | router.get('/get/books', controller.getAllBooks); 8 | 9 | export = router; 10 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/source/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | import bodyParser from 'body-parser'; 3 | import express from 'express'; 4 | import logging from './config/logging'; 5 | import config from './config/config'; 6 | import bookRoutes from './routes/book'; 7 | 8 | const NAMESPACE = 'Server'; 9 | const router = express(); 10 | 11 | /** Log the request */ 12 | router.use((req, res, next) => { 13 | /** Log the req */ 14 | logging.info(NAMESPACE, `METHOD: [${req.method}] - URL: [${req.url}] - IP: [${req.socket.remoteAddress}]`); 15 | 16 | res.on('finish', () => { 17 | /** Log the res */ 18 | logging.info(NAMESPACE, `METHOD: [${req.method}] - URL: [${req.url}] - STATUS: [${res.statusCode}] - IP: [${req.socket.remoteAddress}]`); 19 | }) 20 | 21 | next(); 22 | }); 23 | 24 | /** Parse the body of the request */ 25 | router.use(bodyParser.urlencoded({ extended: true })); 26 | router.use(bodyParser.json()); 27 | 28 | /** Rules of our API */ 29 | router.use((req, res, next) => { 30 | res.header('Access-Control-Allow-Origin', '*'); 31 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); 32 | 33 | if (req.method == 'OPTIONS') { 34 | res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); 35 | return res.status(200).json({}); 36 | } 37 | 38 | next(); 39 | }); 40 | 41 | /** Routes go here */ 42 | router.use('/books', bookRoutes); 43 | 44 | /** Error handling */ 45 | router.use((req, res, next) => { 46 | const error = new Error('Not found'); 47 | 48 | res.status(404).json({ 49 | message: error.message 50 | }); 51 | }); 52 | 53 | const httpServer = http.createServer(router); 54 | 55 | httpServer.listen(config.server.port, () => logging.info(NAMESPACE, `Server is running ${config.server.hostname}:${config.server.port}`)); 56 | -------------------------------------------------------------------------------- /typescript-mysql-quickstart/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | 5 | /* Basic Options */ 6 | // "incremental": true, /* Enable incremental compilation */ 7 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 8 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 9 | // "lib": [], /* Specify library files to be included in the compilation. */ 10 | // "allowJs": true, /* Allow javascript files to be compiled. */ 11 | // "checkJs": true, /* Report errors in .js files. */ 12 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 13 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 14 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 15 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 16 | // "outFile": "./", /* Concatenate and emit output to single file. */ 17 | "outDir": "./build", /* Redirect output structure to the directory. */ 18 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 19 | // "composite": true, /* Enable project compilation */ 20 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 21 | // "removeComments": true, /* Do not emit comments to output. */ 22 | // "noEmit": true, /* Do not emit outputs. */ 23 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 24 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 25 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 26 | 27 | /* Strict Type-Checking Options */ 28 | "strict": true, /* Enable all strict type-checking options. */ 29 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 30 | // "strictNullChecks": true, /* Enable strict null checks. */ 31 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 32 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 33 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 34 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 35 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 36 | 37 | /* Additional Checks */ 38 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 39 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 40 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 41 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 42 | 43 | /* Module Resolution Options */ 44 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 45 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 46 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 47 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 48 | // "typeRoots": [], /* List of folders to include type definitions from. */ 49 | // "types": [], /* Type declaration files to be included in compilation. */ 50 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 51 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 52 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 53 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 54 | 55 | /* Source Map Options */ 56 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 58 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 59 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 60 | 61 | /* Experimental Options */ 62 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 63 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 64 | 65 | /* Advanced Options */ 66 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 67 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 68 | } 69 | } 70 | --------------------------------------------------------------------------------