├── .DS_Store ├── CustomSearchPage ├── .next │ ├── server │ │ ├── middleware-build-manifest.js │ │ ├── middleware-manifest.json │ │ ├── middleware-react-loadable-manifest.js │ │ ├── pages-manifest.json │ │ ├── pages │ │ │ ├── _app.js │ │ │ ├── _document.js │ │ │ └── _error.js │ │ └── webpack-runtime.js │ └── static │ │ ├── chunks │ │ ├── amp.js │ │ ├── main.js │ │ ├── pages │ │ │ ├── _app.js │ │ │ └── _error.js │ │ ├── polyfills.js │ │ ├── react-refresh.js │ │ └── webpack.js │ │ └── development │ │ ├── _buildManifest.js │ │ └── _ssgManifest.js ├── assets │ ├── Background.png │ └── header.png ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages │ ├── _app.tsx │ ├── api │ │ └── hello.ts │ ├── components │ │ └── landingPage.tsx │ └── index.tsx ├── public │ ├── favicon.ico │ └── vercel.svg ├── styles │ ├── Home.module.css │ ├── Startup.module.css │ └── globals.css ├── tsconfig.json └── yarn.lock ├── README.md ├── Travelling_Salesman.js ├── basic-challange ├── PaswordPattern.js ├── ShuffleArray.ts ├── Triangle.js ├── bst.js ├── complementaryDna.js ├── convertToBinary.js ├── createaeslaknat.js ├── deepSum.js ├── flippingMatrix.js └── mostFrequentLargestNumbers.js ├── blabla.js ├── bookshelf-api ├── .eslintrc.json ├── package-lock.json ├── package.json └── src │ ├── books.js │ ├── handler.js │ ├── routes.js │ └── server.js ├── calculate_circle.js ├── colorize-text.js ├── express-vercel ├── .github │ └── workflows │ │ ├── .gitignore │ │ ├── github-ci-vercel-preview.yml │ │ ├── github-ci-vercel-production.yml │ │ └── node.js.yml ├── .gitignore ├── controllers │ └── index.js ├── index.js ├── package-lock.json ├── package.json ├── readme.md ├── routes │ └── index.js └── tests │ └── test.spec.js ├── generate-uuid.js ├── google-play-scraper ├── index.js ├── package-lock.json └── package.json ├── hello-world.js ├── matrix.js ├── phonenumberbyarray-farizz.js ├── random_number.js ├── server.js ├── service-user ├── .DS_Store ├── .gitignore ├── app.js ├── bin │ └── www ├── config │ └── config.js ├── controllers │ ├── RefreshTokenController.js │ └── UserController.js ├── env.example ├── migrations │ ├── 20220124144247-create_users_table.js │ └── 20220124144311-create_refresh_token_table.js ├── models │ ├── RefreshToken.js │ ├── User.js │ └── index.js ├── package-lock.json ├── package.json ├── public │ ├── index.html │ └── stylesheets │ │ └── style.css ├── routes │ ├── index.js │ ├── refreshTokens.js │ └── users.js └── seeders │ └── 20220124150408-user_seeders.js └── static-file-server.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FirmanKurniawan/NodeJS-Projects/f520cdd8e4e1163e3414ba5a6692b24ecad95462/.DS_Store -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/middleware-build-manifest.js: -------------------------------------------------------------------------------- 1 | self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":["static/chunks/webpack.js","static/chunks/amp.js"],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"]},"ampFirstPages":[]} -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/middleware-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "sortedMiddleware": [], 3 | "middleware": {}, 4 | "functions": {}, 5 | "version": 2 6 | } -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/middleware-react-loadable-manifest.js: -------------------------------------------------------------------------------- 1 | self.__REACT_LOADABLE_MANIFEST={} -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/pages-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/_app": "pages/_app.js", 3 | "/_error": "pages/_error.js", 4 | "/_document": "pages/_document.js" 5 | } -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/pages/_app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ATTENTION: An "eval-source-map" devtool has been used. 3 | * This devtool is neither made for production nor for readable output files. 4 | * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. 5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) 6 | * or disable the default devtool with "devtool: false". 7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). 8 | */ 9 | (() => { 10 | var exports = {}; 11 | exports.id = "pages/_app"; 12 | exports.ids = ["pages/_app"]; 13 | exports.modules = { 14 | 15 | /***/ "./pages/_app.tsx": 16 | /*!************************!*\ 17 | !*** ./pages/_app.tsx ***! 18 | \************************/ 19 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 20 | 21 | "use strict"; 22 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ \"react/jsx-dev-runtime\");\n/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _styles_globals_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../styles/globals.css */ \"./styles/globals.css\");\n/* harmony import */ var _styles_globals_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_styles_globals_css__WEBPACK_IMPORTED_MODULE_1__);\n\n\nfunction MyApp({ Component , pageProps }) {\n return /*#__PURE__*/ (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(Component, {\n ...pageProps\n }, void 0, false, {\n fileName: \"/Users/senja/Sandbox/NodeJS-Projects/CustomSearchPage/pages/_app.tsx\",\n lineNumber: 5,\n columnNumber: 10\n }, this);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MyApp);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9wYWdlcy9fYXBwLnRzeC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUFBO0FBQThCO0FBRzlCLFNBQVNBLEtBQUssQ0FBQyxFQUFFQyxTQUFTLEdBQUVDLFNBQVMsR0FBWSxFQUFFO0lBQ2pELHFCQUFPLDhEQUFDRCxTQUFTO1FBQUUsR0FBR0MsU0FBUzs7Ozs7WUFBSTtBQUNyQyxDQUFDO0FBRUQsaUVBQWVGLEtBQUsiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9uZXh0LXN0YXJ0cGFnZS8uL3BhZ2VzL19hcHAudHN4PzJmYmUiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICcuLi9zdHlsZXMvZ2xvYmFscy5jc3MnXG5pbXBvcnQgdHlwZSB7IEFwcFByb3BzIH0gZnJvbSAnbmV4dC9hcHAnXG5cbmZ1bmN0aW9uIE15QXBwKHsgQ29tcG9uZW50LCBwYWdlUHJvcHMgfTogQXBwUHJvcHMpIHtcbiAgcmV0dXJuIDxDb21wb25lbnQgey4uLnBhZ2VQcm9wc30gLz5cbn1cblxuZXhwb3J0IGRlZmF1bHQgTXlBcHBcbiJdLCJuYW1lcyI6WyJNeUFwcCIsIkNvbXBvbmVudCIsInBhZ2VQcm9wcyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./pages/_app.tsx\n"); 23 | 24 | /***/ }), 25 | 26 | /***/ "./styles/globals.css": 27 | /*!****************************!*\ 28 | !*** ./styles/globals.css ***! 29 | \****************************/ 30 | /***/ (() => { 31 | 32 | 33 | 34 | /***/ }), 35 | 36 | /***/ "react/jsx-dev-runtime": 37 | /*!****************************************!*\ 38 | !*** external "react/jsx-dev-runtime" ***! 39 | \****************************************/ 40 | /***/ ((module) => { 41 | 42 | "use strict"; 43 | module.exports = require("react/jsx-dev-runtime"); 44 | 45 | /***/ }) 46 | 47 | }; 48 | ; 49 | 50 | // load runtime 51 | var __webpack_require__ = require("../webpack-runtime.js"); 52 | __webpack_require__.C(exports); 53 | var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) 54 | var __webpack_exports__ = (__webpack_exec__("./pages/_app.tsx")); 55 | module.exports = __webpack_exports__; 56 | 57 | })(); -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/pages/_error.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /* 3 | * ATTENTION: An "eval-source-map" devtool has been used. 4 | * This devtool is neither made for production nor for readable output files. 5 | * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. 6 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) 7 | * or disable the default devtool with "devtool: false". 8 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). 9 | */ 10 | (() => { 11 | var exports = {}; 12 | exports.id = "pages/_error"; 13 | exports.ids = ["pages/_error"]; 14 | exports.modules = { 15 | 16 | /***/ "./node_modules/@swc/helpers/lib/_interop_require_default.js": 17 | /*!*******************************************************************!*\ 18 | !*** ./node_modules/@swc/helpers/lib/_interop_require_default.js ***! 19 | \*******************************************************************/ 20 | /***/ ((__unused_webpack_module, exports) => { 21 | 22 | eval("\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = _interopRequireDefault;\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvQHN3Yy9oZWxwZXJzL2xpYi9faW50ZXJvcF9yZXF1aXJlX2RlZmF1bHQuanMuanMiLCJtYXBwaW5ncyI6IkFBQWE7QUFDYiw4Q0FBNkM7QUFDN0M7QUFDQSxDQUFDLEVBQUM7QUFDRixrQkFBZTtBQUNmO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9uZXh0LXN0YXJ0cGFnZS8uL25vZGVfbW9kdWxlcy9Ac3djL2hlbHBlcnMvbGliL19pbnRlcm9wX3JlcXVpcmVfZGVmYXVsdC5qcz85YjdjIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsIFwiX19lc01vZHVsZVwiLCB7XG4gICAgdmFsdWU6IHRydWVcbn0pO1xuZXhwb3J0cy5kZWZhdWx0ID0gX2ludGVyb3BSZXF1aXJlRGVmYXVsdDtcbmZ1bmN0aW9uIF9pbnRlcm9wUmVxdWlyZURlZmF1bHQob2JqKSB7XG4gICAgcmV0dXJuIG9iaiAmJiBvYmouX19lc01vZHVsZSA/IG9iaiA6IHtcbiAgICAgICAgZGVmYXVsdDogb2JqXG4gICAgfTtcbn1cbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/@swc/helpers/lib/_interop_require_default.js\n"); 23 | 24 | /***/ }), 25 | 26 | /***/ "./node_modules/next/dist/pages/_error.js": 27 | /*!************************************************!*\ 28 | !*** ./node_modules/next/dist/pages/_error.js ***! 29 | \************************************************/ 30 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 31 | 32 | eval("\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _interop_require_default = (__webpack_require__(/*! @swc/helpers/lib/_interop_require_default.js */ \"./node_modules/@swc/helpers/lib/_interop_require_default.js\")[\"default\"]);\nvar _react = _interop_require_default(__webpack_require__(/*! react */ \"react\"));\nvar _head = _interop_require_default(__webpack_require__(/*! ../shared/lib/head */ \"../shared/lib/head\"));\nconst statusCodes = {\n 400: \"Bad Request\",\n 404: \"This page could not be found\",\n 405: \"Method Not Allowed\",\n 500: \"Internal Server Error\"\n};\nfunction _getInitialProps({ res , err }) {\n const statusCode = res && res.statusCode ? res.statusCode : err ? err.statusCode : 404;\n return {\n statusCode\n };\n}\nconst styles = {\n error: {\n fontFamily: '-apple-system, BlinkMacSystemFont, Roboto, \"Segoe UI\", \"Fira Sans\", Avenir, \"Helvetica Neue\", \"Lucida Grande\", sans-serif',\n height: \"100vh\",\n textAlign: \"center\",\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n desc: {\n display: \"inline-block\",\n textAlign: \"left\",\n lineHeight: \"49px\",\n height: \"49px\",\n verticalAlign: \"middle\"\n },\n h1: {\n display: \"inline-block\",\n margin: 0,\n marginRight: \"20px\",\n padding: \"0 23px 0 0\",\n fontSize: \"24px\",\n fontWeight: 500,\n verticalAlign: \"top\",\n lineHeight: \"49px\"\n },\n h2: {\n fontSize: \"14px\",\n fontWeight: \"normal\",\n lineHeight: \"49px\",\n margin: 0,\n padding: 0\n }\n};\nvar _Component;\nclass Error extends (_Component = _react.default.Component) {\n render() {\n const { statusCode , withDarkMode =true } = this.props;\n const title = this.props.title || statusCodes[statusCode] || \"An unexpected error has occurred\";\n return /*#__PURE__*/ _react.default.createElement(\"div\", {\n style: styles.error\n }, /*#__PURE__*/ _react.default.createElement(_head.default, null, /*#__PURE__*/ _react.default.createElement(\"title\", null, statusCode ? `${statusCode}: ${title}` : \"Application error: a client-side exception has occurred\")), /*#__PURE__*/ _react.default.createElement(\"div\", null, /*#__PURE__*/ _react.default.createElement(\"style\", {\n dangerouslySetInnerHTML: {\n __html: `\n body { margin: 0; color: #000; background: #fff; }\n .next-error-h1 {\n border-right: 1px solid rgba(0, 0, 0, .3);\n }\n\n ${withDarkMode ? `@media (prefers-color-scheme: dark) {\n body { color: #fff; background: #000; }\n .next-error-h1 {\n border-right: 1px solid rgba(255, 255, 255, .3);\n }\n }` : \"\"}`\n }\n }), statusCode ? /*#__PURE__*/ _react.default.createElement(\"h1\", {\n className: \"next-error-h1\",\n style: styles.h1\n }, statusCode) : null, /*#__PURE__*/ _react.default.createElement(\"div\", {\n style: styles.desc\n }, /*#__PURE__*/ _react.default.createElement(\"h2\", {\n style: styles.h2\n }, this.props.title || statusCode ? title : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, \"Application error: a client-side exception has occurred (see the browser console for more information)\"), \".\"))));\n }\n}\nError.displayName = \"ErrorPage\";\nError.getInitialProps = _getInitialProps;\nError.origGetInitialProps = _getInitialProps;\nexports[\"default\"] = Error; //# sourceMappingURL=_error.js.map\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvbmV4dC9kaXN0L3BhZ2VzL19lcnJvci5qcy5qcyIsIm1hcHBpbmdzIjoiQUFBYTtBQUNiQSw4Q0FBNkM7SUFDekNHLEtBQUssRUFBRSxJQUFJO0NBQ2QsRUFBQyxDQUFDO0FBQ0hELGtCQUFlLEdBQUcsS0FBSyxDQUFDLENBQUM7QUFDekIsSUFBSUcsd0JBQXdCLEdBQUdDLG1KQUErRDtBQUM5RixJQUFJQyxNQUFNLEdBQUdGLHdCQUF3QixDQUFDQyxtQkFBTyxDQUFDLG9CQUFPLENBQUMsQ0FBQztBQUN2RCxJQUFJRSxLQUFLLEdBQUdILHdCQUF3QixDQUFDQyxtQkFBTyxDQUFDLDhDQUFvQixDQUFDLENBQUM7QUFDbkUsTUFBTUcsV0FBVyxHQUFHO0FBQ2hCLE9BQUcsRUFBRSxhQUFhO0FBQ2xCLE9BQUcsRUFBRSw4QkFBOEI7QUFDbkMsT0FBRyxFQUFFLG9CQUFvQjtBQUN6QixPQUFHLEVBQUUsdUJBQXVCO0NBQy9CO0FBQ0QsU0FBU0MsZ0JBQWdCLENBQUMsRUFBRUMsR0FBRyxHQUFHQyxHQUFHLEdBQUcsRUFBRTtJQUN0QyxNQUFNQyxVQUFVLEdBQUdGLEdBQUcsSUFBSUEsR0FBRyxDQUFDRSxVQUFVLEdBQUdGLEdBQUcsQ0FBQ0UsVUFBVSxHQUFHRCxHQUFHLEdBQUdBLEdBQUcsQ0FBQ0MsVUFBVSxHQUFHLEdBQUc7SUFDdEYsT0FBTztRQUNIQSxVQUFVO0tBQ2IsQ0FBQztBQUNOLENBQUM7QUFDRCxNQUFNQyxNQUFNLEdBQUc7SUFDWEMsS0FBSyxFQUFFO1FBQ0hDLFVBQVUsRUFBRSwySEFBMkg7UUFDdklDLE1BQU0sRUFBRSxPQUFPO1FBQ2ZDLFNBQVMsRUFBRSxRQUFRO1FBQ25CQyxPQUFPLEVBQUUsTUFBTTtRQUNmQyxhQUFhLEVBQUUsUUFBUTtRQUN2QkMsVUFBVSxFQUFFLFFBQVE7UUFDcEJDLGNBQWMsRUFBRSxRQUFRO0tBQzNCO0lBQ0RDLElBQUksRUFBRTtRQUNGSixPQUFPLEVBQUUsY0FBYztRQUN2QkQsU0FBUyxFQUFFLE1BQU07UUFDakJNLFVBQVUsRUFBRSxNQUFNO1FBQ2xCUCxNQUFNLEVBQUUsTUFBTTtRQUNkUSxhQUFhLEVBQUUsUUFBUTtLQUMxQjtJQUNEQyxFQUFFLEVBQUU7UUFDQVAsT0FBTyxFQUFFLGNBQWM7UUFDdkJRLE1BQU0sRUFBRSxDQUFDO1FBQ1RDLFdBQVcsRUFBRSxNQUFNO1FBQ25CQyxPQUFPLEVBQUUsWUFBWTtRQUNyQkMsUUFBUSxFQUFFLE1BQU07UUFDaEJDLFVBQVUsRUFBRSxHQUFHO1FBQ2ZOLGFBQWEsRUFBRSxLQUFLO1FBQ3BCRCxVQUFVLEVBQUUsTUFBTTtLQUNyQjtJQUNEUSxFQUFFLEVBQUU7UUFDQUYsUUFBUSxFQUFFLE1BQU07UUFDaEJDLFVBQVUsRUFBRSxRQUFRO1FBQ3BCUCxVQUFVLEVBQUUsTUFBTTtRQUNsQkcsTUFBTSxFQUFFLENBQUM7UUFDVEUsT0FBTyxFQUFFLENBQUM7S0FDYjtDQUNKO0FBQ0QsSUFBSUksVUFBVTtBQUNkLE1BQU1DLEtBQUssU0FBVUQsQ0FBQUEsVUFBVSxHQUFHMUIsTUFBTSxDQUFDSCxPQUFPLENBQUMrQixTQUFTO0lBQ3REQyxNQUFNLEdBQUc7UUFDTCxNQUFNLEVBQUV2QixVQUFVLEdBQUd3QixZQUFZLEVBQUUsSUFBSSxHQUFHLEdBQUcsSUFBSSxDQUFDQyxLQUFLO1FBQ3ZELE1BQU1DLEtBQUssR0FBRyxJQUFJLENBQUNELEtBQUssQ0FBQ0MsS0FBSyxJQUFJOUIsV0FBVyxDQUFDSSxVQUFVLENBQUMsSUFBSSxrQ0FBa0M7UUFDL0YsT0FBTyxXQUFXLEdBQUdOLE1BQU0sQ0FBQ0gsT0FBTyxDQUFDb0MsYUFBYSxDQUFDLEtBQUssRUFBRTtZQUNyREMsS0FBSyxFQUFFM0IsTUFBTSxDQUFDQyxLQUFLO1NBQ3RCLEVBQUUsV0FBVyxHQUFHUixNQUFNLENBQUNILE9BQU8sQ0FBQ29DLGFBQWEsQ0FBQ2hDLEtBQUssQ0FBQ0osT0FBTyxFQUFFLElBQUksRUFBRSxXQUFXLEdBQUdHLE1BQU0sQ0FBQ0gsT0FBTyxDQUFDb0MsYUFBYSxDQUFDLE9BQU8sRUFBRSxJQUFJLEVBQUUzQixVQUFVLEdBQUcsQ0FBQyxFQUFFQSxVQUFVLENBQUMsRUFBRSxFQUFFMEIsS0FBSyxDQUFDLENBQUMsR0FBRyx5REFBeUQsQ0FBQyxDQUFDLEVBQUUsV0FBVyxHQUFHaEMsTUFBTSxDQUFDSCxPQUFPLENBQUNvQyxhQUFhLENBQUMsS0FBSyxFQUFFLElBQUksRUFBRSxXQUFXLEdBQUdqQyxNQUFNLENBQUNILE9BQU8sQ0FBQ29DLGFBQWEsQ0FBQyxPQUFPLEVBQUU7WUFDM1VFLHVCQUF1QixFQUFFO2dCQUNyQkMsTUFBTSxFQUFFLENBQUM7Ozs7OztnQkFNVCxFQUFFTixZQUFZLEdBQUcsQ0FBQzs7Ozs7aUJBS2pCLENBQUMsR0FBRyxFQUFFLENBQUMsQ0FBQzthQUNaO1NBQ0osQ0FBQyxFQUFFeEIsVUFBVSxHQUFHLFdBQVcsR0FBR04sTUFBTSxDQUFDSCxPQUFPLENBQUNvQyxhQUFhLENBQUMsSUFBSSxFQUFFO1lBQzlESSxTQUFTLEVBQUUsZUFBZTtZQUMxQkgsS0FBSyxFQUFFM0IsTUFBTSxDQUFDWSxFQUFFO1NBQ25CLEVBQUViLFVBQVUsQ0FBQyxHQUFHLElBQUksRUFBRSxXQUFXLEdBQUdOLE1BQU0sQ0FBQ0gsT0FBTyxDQUFDb0MsYUFBYSxDQUFDLEtBQUssRUFBRTtZQUNyRUMsS0FBSyxFQUFFM0IsTUFBTSxDQUFDUyxJQUFJO1NBQ3JCLEVBQUUsV0FBVyxHQUFHaEIsTUFBTSxDQUFDSCxPQUFPLENBQUNvQyxhQUFhLENBQUMsSUFBSSxFQUFFO1lBQ2hEQyxLQUFLLEVBQUUzQixNQUFNLENBQUNrQixFQUFFO1NBQ25CLEVBQUUsSUFBSSxDQUFDTSxLQUFLLENBQUNDLEtBQUssSUFBSTFCLFVBQVUsR0FBRzBCLEtBQUssR0FBRyxXQUFXLEdBQUdoQyxNQUFNLENBQUNILE9BQU8sQ0FBQ29DLGFBQWEsQ0FBQ2pDLE1BQU0sQ0FBQ0gsT0FBTyxDQUFDeUMsUUFBUSxFQUFFLElBQUksRUFBRSx3R0FBd0csQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQzdPO0NBQ0g7QUFDRFgsS0FBSyxDQUFDWSxXQUFXLEdBQUcsV0FBVyxDQUFDO0FBQ2hDWixLQUFLLENBQUNhLGVBQWUsR0FBR3JDLGdCQUFnQixDQUFDO0FBQ3pDd0IsS0FBSyxDQUFDYyxtQkFBbUIsR0FBR3RDLGdCQUFnQixDQUFDO0FBQzdDUixrQkFBZSxHQUFHZ0MsS0FBSyxDQUFDLENBRXhCLGtDQUFrQyIsInNvdXJjZXMiOlsid2VicGFjazovL25leHQtc3RhcnRwYWdlLy4vbm9kZV9tb2R1bGVzL25leHQvZGlzdC9wYWdlcy9fZXJyb3IuanM/MThmMiJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcbk9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzLCBcIl9fZXNNb2R1bGVcIiwge1xuICAgIHZhbHVlOiB0cnVlXG59KTtcbmV4cG9ydHMuZGVmYXVsdCA9IHZvaWQgMDtcbnZhciBfaW50ZXJvcF9yZXF1aXJlX2RlZmF1bHQgPSByZXF1aXJlKFwiQHN3Yy9oZWxwZXJzL2xpYi9faW50ZXJvcF9yZXF1aXJlX2RlZmF1bHQuanNcIikuZGVmYXVsdDtcbnZhciBfcmVhY3QgPSBfaW50ZXJvcF9yZXF1aXJlX2RlZmF1bHQocmVxdWlyZShcInJlYWN0XCIpKTtcbnZhciBfaGVhZCA9IF9pbnRlcm9wX3JlcXVpcmVfZGVmYXVsdChyZXF1aXJlKFwiLi4vc2hhcmVkL2xpYi9oZWFkXCIpKTtcbmNvbnN0IHN0YXR1c0NvZGVzID0ge1xuICAgIDQwMDogJ0JhZCBSZXF1ZXN0JyxcbiAgICA0MDQ6ICdUaGlzIHBhZ2UgY291bGQgbm90IGJlIGZvdW5kJyxcbiAgICA0MDU6ICdNZXRob2QgTm90IEFsbG93ZWQnLFxuICAgIDUwMDogJ0ludGVybmFsIFNlcnZlciBFcnJvcidcbn07XG5mdW5jdGlvbiBfZ2V0SW5pdGlhbFByb3BzKHsgcmVzICwgZXJyICB9KSB7XG4gICAgY29uc3Qgc3RhdHVzQ29kZSA9IHJlcyAmJiByZXMuc3RhdHVzQ29kZSA/IHJlcy5zdGF0dXNDb2RlIDogZXJyID8gZXJyLnN0YXR1c0NvZGUgOiA0MDQ7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgc3RhdHVzQ29kZVxuICAgIH07XG59XG5jb25zdCBzdHlsZXMgPSB7XG4gICAgZXJyb3I6IHtcbiAgICAgICAgZm9udEZhbWlseTogJy1hcHBsZS1zeXN0ZW0sIEJsaW5rTWFjU3lzdGVtRm9udCwgUm9ib3RvLCBcIlNlZ29lIFVJXCIsIFwiRmlyYSBTYW5zXCIsIEF2ZW5pciwgXCJIZWx2ZXRpY2EgTmV1ZVwiLCBcIkx1Y2lkYSBHcmFuZGVcIiwgc2Fucy1zZXJpZicsXG4gICAgICAgIGhlaWdodDogJzEwMHZoJyxcbiAgICAgICAgdGV4dEFsaWduOiAnY2VudGVyJyxcbiAgICAgICAgZGlzcGxheTogJ2ZsZXgnLFxuICAgICAgICBmbGV4RGlyZWN0aW9uOiAnY29sdW1uJyxcbiAgICAgICAgYWxpZ25JdGVtczogJ2NlbnRlcicsXG4gICAgICAgIGp1c3RpZnlDb250ZW50OiAnY2VudGVyJ1xuICAgIH0sXG4gICAgZGVzYzoge1xuICAgICAgICBkaXNwbGF5OiAnaW5saW5lLWJsb2NrJyxcbiAgICAgICAgdGV4dEFsaWduOiAnbGVmdCcsXG4gICAgICAgIGxpbmVIZWlnaHQ6ICc0OXB4JyxcbiAgICAgICAgaGVpZ2h0OiAnNDlweCcsXG4gICAgICAgIHZlcnRpY2FsQWxpZ246ICdtaWRkbGUnXG4gICAgfSxcbiAgICBoMToge1xuICAgICAgICBkaXNwbGF5OiAnaW5saW5lLWJsb2NrJyxcbiAgICAgICAgbWFyZ2luOiAwLFxuICAgICAgICBtYXJnaW5SaWdodDogJzIwcHgnLFxuICAgICAgICBwYWRkaW5nOiAnMCAyM3B4IDAgMCcsXG4gICAgICAgIGZvbnRTaXplOiAnMjRweCcsXG4gICAgICAgIGZvbnRXZWlnaHQ6IDUwMCxcbiAgICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICAgIGxpbmVIZWlnaHQ6ICc0OXB4J1xuICAgIH0sXG4gICAgaDI6IHtcbiAgICAgICAgZm9udFNpemU6ICcxNHB4JyxcbiAgICAgICAgZm9udFdlaWdodDogJ25vcm1hbCcsXG4gICAgICAgIGxpbmVIZWlnaHQ6ICc0OXB4JyxcbiAgICAgICAgbWFyZ2luOiAwLFxuICAgICAgICBwYWRkaW5nOiAwXG4gICAgfVxufTtcbnZhciBfQ29tcG9uZW50O1xuY2xhc3MgRXJyb3IgZXh0ZW5kcyAoX0NvbXBvbmVudCA9IF9yZWFjdC5kZWZhdWx0LkNvbXBvbmVudCkge1xuICAgIHJlbmRlcigpIHtcbiAgICAgICAgY29uc3QgeyBzdGF0dXNDb2RlICwgd2l0aERhcmtNb2RlID10cnVlICB9ID0gdGhpcy5wcm9wcztcbiAgICAgICAgY29uc3QgdGl0bGUgPSB0aGlzLnByb3BzLnRpdGxlIHx8IHN0YXR1c0NvZGVzW3N0YXR1c0NvZGVdIHx8ICdBbiB1bmV4cGVjdGVkIGVycm9yIGhhcyBvY2N1cnJlZCc7XG4gICAgICAgIHJldHVybiAvKiNfX1BVUkVfXyovIF9yZWFjdC5kZWZhdWx0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge1xuICAgICAgICAgICAgc3R5bGU6IHN0eWxlcy5lcnJvclxuICAgICAgICB9LCAvKiNfX1BVUkVfXyovIF9yZWFjdC5kZWZhdWx0LmNyZWF0ZUVsZW1lbnQoX2hlYWQuZGVmYXVsdCwgbnVsbCwgLyojX19QVVJFX18qLyBfcmVhY3QuZGVmYXVsdC5jcmVhdGVFbGVtZW50KFwidGl0bGVcIiwgbnVsbCwgc3RhdHVzQ29kZSA/IGAke3N0YXR1c0NvZGV9OiAke3RpdGxlfWAgOiAnQXBwbGljYXRpb24gZXJyb3I6IGEgY2xpZW50LXNpZGUgZXhjZXB0aW9uIGhhcyBvY2N1cnJlZCcpKSwgLyojX19QVVJFX18qLyBfcmVhY3QuZGVmYXVsdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIG51bGwsIC8qI19fUFVSRV9fKi8gX3JlYWN0LmRlZmF1bHQuY3JlYXRlRWxlbWVudChcInN0eWxlXCIsIHtcbiAgICAgICAgICAgIGRhbmdlcm91c2x5U2V0SW5uZXJIVE1MOiB7XG4gICAgICAgICAgICAgICAgX19odG1sOiBgXG4gICAgICAgICAgICAgICAgYm9keSB7IG1hcmdpbjogMDsgY29sb3I6ICMwMDA7IGJhY2tncm91bmQ6ICNmZmY7IH1cbiAgICAgICAgICAgICAgICAubmV4dC1lcnJvci1oMSB7XG4gICAgICAgICAgICAgICAgICBib3JkZXItcmlnaHQ6IDFweCBzb2xpZCByZ2JhKDAsIDAsIDAsIC4zKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAke3dpdGhEYXJrTW9kZSA/IGBAbWVkaWEgKHByZWZlcnMtY29sb3Itc2NoZW1lOiBkYXJrKSB7XG4gICAgICAgICAgICAgICAgICBib2R5IHsgY29sb3I6ICNmZmY7IGJhY2tncm91bmQ6ICMwMDA7IH1cbiAgICAgICAgICAgICAgICAgIC5uZXh0LWVycm9yLWgxIHtcbiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLXJpZ2h0OiAxcHggc29saWQgcmdiYSgyNTUsIDI1NSwgMjU1LCAuMyk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfWAgOiAnJ31gXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pLCBzdGF0dXNDb2RlID8gLyojX19QVVJFX18qLyBfcmVhY3QuZGVmYXVsdC5jcmVhdGVFbGVtZW50KFwiaDFcIiwge1xuICAgICAgICAgICAgY2xhc3NOYW1lOiBcIm5leHQtZXJyb3ItaDFcIixcbiAgICAgICAgICAgIHN0eWxlOiBzdHlsZXMuaDFcbiAgICAgICAgfSwgc3RhdHVzQ29kZSkgOiBudWxsLCAvKiNfX1BVUkVfXyovIF9yZWFjdC5kZWZhdWx0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge1xuICAgICAgICAgICAgc3R5bGU6IHN0eWxlcy5kZXNjXG4gICAgICAgIH0sIC8qI19fUFVSRV9fKi8gX3JlYWN0LmRlZmF1bHQuY3JlYXRlRWxlbWVudChcImgyXCIsIHtcbiAgICAgICAgICAgIHN0eWxlOiBzdHlsZXMuaDJcbiAgICAgICAgfSwgdGhpcy5wcm9wcy50aXRsZSB8fCBzdGF0dXNDb2RlID8gdGl0bGUgOiAvKiNfX1BVUkVfXyovIF9yZWFjdC5kZWZhdWx0LmNyZWF0ZUVsZW1lbnQoX3JlYWN0LmRlZmF1bHQuRnJhZ21lbnQsIG51bGwsIFwiQXBwbGljYXRpb24gZXJyb3I6IGEgY2xpZW50LXNpZGUgZXhjZXB0aW9uIGhhcyBvY2N1cnJlZCAoc2VlIHRoZSBicm93c2VyIGNvbnNvbGUgZm9yIG1vcmUgaW5mb3JtYXRpb24pXCIpLCBcIi5cIikpKSk7XG4gICAgfVxufVxuRXJyb3IuZGlzcGxheU5hbWUgPSAnRXJyb3JQYWdlJztcbkVycm9yLmdldEluaXRpYWxQcm9wcyA9IF9nZXRJbml0aWFsUHJvcHM7XG5FcnJvci5vcmlnR2V0SW5pdGlhbFByb3BzID0gX2dldEluaXRpYWxQcm9wcztcbmV4cG9ydHMuZGVmYXVsdCA9IEVycm9yO1xuXG4vLyMgc291cmNlTWFwcGluZ1VSTD1fZXJyb3IuanMubWFwIl0sIm5hbWVzIjpbIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZXhwb3J0cyIsInZhbHVlIiwiZGVmYXVsdCIsIl9pbnRlcm9wX3JlcXVpcmVfZGVmYXVsdCIsInJlcXVpcmUiLCJfcmVhY3QiLCJfaGVhZCIsInN0YXR1c0NvZGVzIiwiX2dldEluaXRpYWxQcm9wcyIsInJlcyIsImVyciIsInN0YXR1c0NvZGUiLCJzdHlsZXMiLCJlcnJvciIsImZvbnRGYW1pbHkiLCJoZWlnaHQiLCJ0ZXh0QWxpZ24iLCJkaXNwbGF5IiwiZmxleERpcmVjdGlvbiIsImFsaWduSXRlbXMiLCJqdXN0aWZ5Q29udGVudCIsImRlc2MiLCJsaW5lSGVpZ2h0IiwidmVydGljYWxBbGlnbiIsImgxIiwibWFyZ2luIiwibWFyZ2luUmlnaHQiLCJwYWRkaW5nIiwiZm9udFNpemUiLCJmb250V2VpZ2h0IiwiaDIiLCJfQ29tcG9uZW50IiwiRXJyb3IiLCJDb21wb25lbnQiLCJyZW5kZXIiLCJ3aXRoRGFya01vZGUiLCJwcm9wcyIsInRpdGxlIiwiY3JlYXRlRWxlbWVudCIsInN0eWxlIiwiZGFuZ2Vyb3VzbHlTZXRJbm5lckhUTUwiLCJfX2h0bWwiLCJjbGFzc05hbWUiLCJGcmFnbWVudCIsImRpc3BsYXlOYW1lIiwiZ2V0SW5pdGlhbFByb3BzIiwib3JpZ0dldEluaXRpYWxQcm9wcyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/next/dist/pages/_error.js\n"); 33 | 34 | /***/ }), 35 | 36 | /***/ "../shared/lib/head": 37 | /*!***********************************************!*\ 38 | !*** external "next/dist/shared/lib/head.js" ***! 39 | \***********************************************/ 40 | /***/ ((module) => { 41 | 42 | module.exports = require("next/dist/shared/lib/head.js"); 43 | 44 | /***/ }), 45 | 46 | /***/ "react": 47 | /*!************************!*\ 48 | !*** external "react" ***! 49 | \************************/ 50 | /***/ ((module) => { 51 | 52 | module.exports = require("react"); 53 | 54 | /***/ }) 55 | 56 | }; 57 | ; 58 | 59 | // load runtime 60 | var __webpack_require__ = require("../webpack-runtime.js"); 61 | __webpack_require__.C(exports); 62 | var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) 63 | var __webpack_exports__ = (__webpack_exec__("./node_modules/next/dist/pages/_error.js")); 64 | module.exports = __webpack_exports__; 65 | 66 | })(); -------------------------------------------------------------------------------- /CustomSearchPage/.next/server/webpack-runtime.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ATTENTION: An "eval-source-map" devtool has been used. 3 | * This devtool is neither made for production nor for readable output files. 4 | * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. 5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) 6 | * or disable the default devtool with "devtool: false". 7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). 8 | */ 9 | /******/ (() => { // webpackBootstrap 10 | /******/ "use strict"; 11 | /******/ var __webpack_modules__ = ({}); 12 | /************************************************************************/ 13 | /******/ // The module cache 14 | /******/ var __webpack_module_cache__ = {}; 15 | /******/ 16 | /******/ // The require function 17 | /******/ function __webpack_require__(moduleId) { 18 | /******/ // Check if module is in cache 19 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 20 | /******/ if (cachedModule !== undefined) { 21 | /******/ return cachedModule.exports; 22 | /******/ } 23 | /******/ // Create a new module (and put it into the cache) 24 | /******/ var module = __webpack_module_cache__[moduleId] = { 25 | /******/ // no module.id needed 26 | /******/ // no module.loaded needed 27 | /******/ exports: {} 28 | /******/ }; 29 | /******/ 30 | /******/ // Execute the module function 31 | /******/ var threw = true; 32 | /******/ try { 33 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 34 | /******/ threw = false; 35 | /******/ } finally { 36 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; 37 | /******/ } 38 | /******/ 39 | /******/ // Return the exports of the module 40 | /******/ return module.exports; 41 | /******/ } 42 | /******/ 43 | /******/ // expose the modules object (__webpack_modules__) 44 | /******/ __webpack_require__.m = __webpack_modules__; 45 | /******/ 46 | /************************************************************************/ 47 | /******/ /* webpack/runtime/compat get default export */ 48 | /******/ (() => { 49 | /******/ // getDefaultExport function for compatibility with non-harmony modules 50 | /******/ __webpack_require__.n = (module) => { 51 | /******/ var getter = module && module.__esModule ? 52 | /******/ () => (module['default']) : 53 | /******/ () => (module); 54 | /******/ __webpack_require__.d(getter, { a: getter }); 55 | /******/ return getter; 56 | /******/ }; 57 | /******/ })(); 58 | /******/ 59 | /******/ /* webpack/runtime/define property getters */ 60 | /******/ (() => { 61 | /******/ // define getter functions for harmony exports 62 | /******/ __webpack_require__.d = (exports, definition) => { 63 | /******/ for(var key in definition) { 64 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 65 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 66 | /******/ } 67 | /******/ } 68 | /******/ }; 69 | /******/ })(); 70 | /******/ 71 | /******/ /* webpack/runtime/ensure chunk */ 72 | /******/ (() => { 73 | /******/ __webpack_require__.f = {}; 74 | /******/ // This file contains only the entry chunk. 75 | /******/ // The chunk loading function for additional chunks 76 | /******/ __webpack_require__.e = (chunkId) => { 77 | /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => { 78 | /******/ __webpack_require__.f[key](chunkId, promises); 79 | /******/ return promises; 80 | /******/ }, [])); 81 | /******/ }; 82 | /******/ })(); 83 | /******/ 84 | /******/ /* webpack/runtime/get javascript chunk filename */ 85 | /******/ (() => { 86 | /******/ // This function allow to reference async chunks and sibling chunks for the entrypoint 87 | /******/ __webpack_require__.u = (chunkId) => { 88 | /******/ // return url for filenames based on template 89 | /******/ return undefined; 90 | /******/ }; 91 | /******/ })(); 92 | /******/ 93 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ 94 | /******/ (() => { 95 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 96 | /******/ })(); 97 | /******/ 98 | /******/ /* webpack/runtime/make namespace object */ 99 | /******/ (() => { 100 | /******/ // define __esModule on exports 101 | /******/ __webpack_require__.r = (exports) => { 102 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 103 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 104 | /******/ } 105 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 106 | /******/ }; 107 | /******/ })(); 108 | /******/ 109 | /******/ /* webpack/runtime/startup entrypoint */ 110 | /******/ (() => { 111 | /******/ __webpack_require__.X = (result, chunkIds, fn) => { 112 | /******/ // arguments: chunkIds, moduleId are deprecated 113 | /******/ var moduleId = chunkIds; 114 | /******/ if(!fn) chunkIds = result, fn = () => (__webpack_require__(__webpack_require__.s = moduleId)); 115 | /******/ chunkIds.map(__webpack_require__.e, __webpack_require__) 116 | /******/ var r = fn(); 117 | /******/ return r === undefined ? result : r; 118 | /******/ } 119 | /******/ })(); 120 | /******/ 121 | /******/ /* webpack/runtime/require chunk loading */ 122 | /******/ (() => { 123 | /******/ // no baseURI 124 | /******/ 125 | /******/ // object to store loaded chunks 126 | /******/ // "1" means "loaded", otherwise not loaded yet 127 | /******/ var installedChunks = { 128 | /******/ "webpack-runtime": 1 129 | /******/ }; 130 | /******/ 131 | /******/ // no on chunks loaded 132 | /******/ 133 | /******/ var installChunk = (chunk) => { 134 | /******/ var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime; 135 | /******/ for(var moduleId in moreModules) { 136 | /******/ if(__webpack_require__.o(moreModules, moduleId)) { 137 | /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 138 | /******/ } 139 | /******/ } 140 | /******/ if(runtime) runtime(__webpack_require__); 141 | /******/ for(var i = 0; i < chunkIds.length; i++) 142 | /******/ installedChunks[chunkIds[i]] = 1; 143 | /******/ 144 | /******/ }; 145 | /******/ 146 | /******/ // require() chunk loading for javascript 147 | /******/ __webpack_require__.f.require = (chunkId, promises) => { 148 | /******/ // "1" is the signal for "already loaded" 149 | /******/ if(!installedChunks[chunkId]) { 150 | /******/ if("webpack-runtime" != chunkId) { 151 | /******/ installChunk(require("./" + __webpack_require__.u(chunkId))); 152 | /******/ } else installedChunks[chunkId] = 1; 153 | /******/ } 154 | /******/ }; 155 | /******/ 156 | /******/ module.exports = __webpack_require__; 157 | /******/ __webpack_require__.C = installChunk; 158 | /******/ 159 | /******/ // no HMR 160 | /******/ 161 | /******/ // no HMR manifest 162 | /******/ })(); 163 | /******/ 164 | /************************************************************************/ 165 | /******/ 166 | /******/ 167 | /******/ })() 168 | ; -------------------------------------------------------------------------------- /CustomSearchPage/.next/static/chunks/pages/_error.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ATTENTION: An "eval-source-map" devtool has been used. 3 | * This devtool is neither made for production nor for readable output files. 4 | * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. 5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) 6 | * or disable the default devtool with "devtool: false". 7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). 8 | */ 9 | (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([["pages/_error"],{ 10 | 11 | /***/ "./node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_error&page=%2F_error!": 12 | /*!***********************************************************************************************************************************************!*\ 13 | !*** ./node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_error&page=%2F_error! ***! 14 | \***********************************************************************************************************************************************/ 15 | /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 16 | 17 | eval(__webpack_require__.ts("\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/_error\",\n function () {\n return __webpack_require__(/*! private-next-pages/_error */ \"./node_modules/next/dist/pages/_error.js\");\n }\n ]);\n if(true) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/_error\"])\n });\n }\n //# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvbmV4dC9kaXN0L2J1aWxkL3dlYnBhY2svbG9hZGVycy9uZXh0LWNsaWVudC1wYWdlcy1sb2FkZXIuanM/YWJzb2x1dGVQYWdlUGF0aD1wcml2YXRlLW5leHQtcGFnZXMlMkZfZXJyb3ImcGFnZT0lMkZfZXJyb3IhLmpzIiwibWFwcGluZ3MiOiI7QUFDQTtBQUNBO0FBQ0E7QUFDQSxlQUFlLG1CQUFPLENBQUMsMkVBQTJCO0FBQ2xEO0FBQ0E7QUFDQSxPQUFPLElBQVU7QUFDakIsTUFBTSxVQUFVO0FBQ2hCO0FBQ0EsT0FBTztBQUNQO0FBQ0EiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9fTl9FLz84MDdiIl0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICh3aW5kb3cuX19ORVhUX1AgPSB3aW5kb3cuX19ORVhUX1AgfHwgW10pLnB1c2goW1xuICAgICAgXCIvX2Vycm9yXCIsXG4gICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiByZXF1aXJlKFwicHJpdmF0ZS1uZXh0LXBhZ2VzL19lcnJvclwiKTtcbiAgICAgIH1cbiAgICBdKTtcbiAgICBpZihtb2R1bGUuaG90KSB7XG4gICAgICBtb2R1bGUuaG90LmRpc3Bvc2UoZnVuY3Rpb24gKCkge1xuICAgICAgICB3aW5kb3cuX19ORVhUX1AucHVzaChbXCIvX2Vycm9yXCJdKVxuICAgICAgfSk7XG4gICAgfVxuICAiXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_error&page=%2F_error!\n")); 18 | 19 | /***/ }) 20 | 21 | }, 22 | /******/ function(__webpack_require__) { // webpackRuntimeModules 23 | /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } 24 | /******/ __webpack_require__.O(0, ["pages/_app","main"], function() { return __webpack_exec__("./node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_error&page=%2F_error!"); }); 25 | /******/ var __webpack_exports__ = __webpack_require__.O(); 26 | /******/ _N_E = __webpack_exports__; 27 | /******/ } 28 | ]); -------------------------------------------------------------------------------- /CustomSearchPage/.next/static/chunks/webpack.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ATTENTION: An "eval-source-map" devtool has been used. 3 | * This devtool is neither made for production nor for readable output files. 4 | * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. 5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) 6 | * or disable the default devtool with "devtool: false". 7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). 8 | */ 9 | /******/ (function() { // webpackBootstrap 10 | /******/ "use strict"; 11 | /******/ var __webpack_modules__ = ({}); 12 | /************************************************************************/ 13 | /******/ // The module cache 14 | /******/ var __webpack_module_cache__ = {}; 15 | /******/ 16 | /******/ // The require function 17 | /******/ function __webpack_require__(moduleId) { 18 | /******/ // Check if module is in cache 19 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 20 | /******/ if (cachedModule !== undefined) { 21 | /******/ if (cachedModule.error !== undefined) throw cachedModule.error; 22 | /******/ return cachedModule.exports; 23 | /******/ } 24 | /******/ // Create a new module (and put it into the cache) 25 | /******/ var module = __webpack_module_cache__[moduleId] = { 26 | /******/ id: moduleId, 27 | /******/ loaded: false, 28 | /******/ exports: {} 29 | /******/ }; 30 | /******/ 31 | /******/ // Execute the module function 32 | /******/ var threw = true; 33 | /******/ try { 34 | /******/ var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ }; 35 | /******/ __webpack_require__.i.forEach(function(handler) { handler(execOptions); }); 36 | /******/ module = execOptions.module; 37 | /******/ execOptions.factory.call(module.exports, module, module.exports, execOptions.require); 38 | /******/ threw = false; 39 | /******/ } finally { 40 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; 41 | /******/ } 42 | /******/ 43 | /******/ // Flag the module as loaded 44 | /******/ module.loaded = true; 45 | /******/ 46 | /******/ // Return the exports of the module 47 | /******/ return module.exports; 48 | /******/ } 49 | /******/ 50 | /******/ // expose the modules object (__webpack_modules__) 51 | /******/ __webpack_require__.m = __webpack_modules__; 52 | /******/ 53 | /******/ // expose the module cache 54 | /******/ __webpack_require__.c = __webpack_module_cache__; 55 | /******/ 56 | /******/ // expose the module execution interceptor 57 | /******/ __webpack_require__.i = []; 58 | /******/ 59 | /************************************************************************/ 60 | /******/ /* webpack/runtime/chunk loaded */ 61 | /******/ !function() { 62 | /******/ var deferred = []; 63 | /******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { 64 | /******/ if(chunkIds) { 65 | /******/ priority = priority || 0; 66 | /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; 67 | /******/ deferred[i] = [chunkIds, fn, priority]; 68 | /******/ return; 69 | /******/ } 70 | /******/ var notFulfilled = Infinity; 71 | /******/ for (var i = 0; i < deferred.length; i++) { 72 | /******/ var chunkIds = deferred[i][0]; 73 | /******/ var fn = deferred[i][1]; 74 | /******/ var priority = deferred[i][2]; 75 | /******/ var fulfilled = true; 76 | /******/ for (var j = 0; j < chunkIds.length; j++) { 77 | /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { 78 | /******/ chunkIds.splice(j--, 1); 79 | /******/ } else { 80 | /******/ fulfilled = false; 81 | /******/ if(priority < notFulfilled) notFulfilled = priority; 82 | /******/ } 83 | /******/ } 84 | /******/ if(fulfilled) { 85 | /******/ deferred.splice(i--, 1) 86 | /******/ var r = fn(); 87 | /******/ if (r !== undefined) result = r; 88 | /******/ } 89 | /******/ } 90 | /******/ return result; 91 | /******/ }; 92 | /******/ }(); 93 | /******/ 94 | /******/ /* webpack/runtime/compat get default export */ 95 | /******/ !function() { 96 | /******/ // getDefaultExport function for compatibility with non-harmony modules 97 | /******/ __webpack_require__.n = function(module) { 98 | /******/ var getter = module && module.__esModule ? 99 | /******/ function() { return module['default']; } : 100 | /******/ function() { return module; }; 101 | /******/ __webpack_require__.d(getter, { a: getter }); 102 | /******/ return getter; 103 | /******/ }; 104 | /******/ }(); 105 | /******/ 106 | /******/ /* webpack/runtime/define property getters */ 107 | /******/ !function() { 108 | /******/ // define getter functions for harmony exports 109 | /******/ __webpack_require__.d = function(exports, definition) { 110 | /******/ for(var key in definition) { 111 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 112 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 113 | /******/ } 114 | /******/ } 115 | /******/ }; 116 | /******/ }(); 117 | /******/ 118 | /******/ /* webpack/runtime/get javascript update chunk filename */ 119 | /******/ !function() { 120 | /******/ // This function allow to reference all chunks 121 | /******/ __webpack_require__.hu = function(chunkId) { 122 | /******/ // return url for filenames based on template 123 | /******/ return "static/webpack/" + chunkId + "." + __webpack_require__.h() + ".hot-update.js"; 124 | /******/ }; 125 | /******/ }(); 126 | /******/ 127 | /******/ /* webpack/runtime/get update manifest filename */ 128 | /******/ !function() { 129 | /******/ __webpack_require__.hmrF = function() { return "static/webpack/" + __webpack_require__.h() + ".webpack.hot-update.json"; }; 130 | /******/ }(); 131 | /******/ 132 | /******/ /* webpack/runtime/getFullHash */ 133 | /******/ !function() { 134 | /******/ __webpack_require__.h = function() { return "bb1b9a1b54ee5fac"; } 135 | /******/ }(); 136 | /******/ 137 | /******/ /* webpack/runtime/global */ 138 | /******/ !function() { 139 | /******/ __webpack_require__.g = (function() { 140 | /******/ if (typeof globalThis === 'object') return globalThis; 141 | /******/ try { 142 | /******/ return this || new Function('return this')(); 143 | /******/ } catch (e) { 144 | /******/ if (typeof window === 'object') return window; 145 | /******/ } 146 | /******/ })(); 147 | /******/ }(); 148 | /******/ 149 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ 150 | /******/ !function() { 151 | /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 152 | /******/ }(); 153 | /******/ 154 | /******/ /* webpack/runtime/load script */ 155 | /******/ !function() { 156 | /******/ var inProgress = {}; 157 | /******/ var dataWebpackPrefix = "_N_E:"; 158 | /******/ // loadScript function to load a script via script tag 159 | /******/ __webpack_require__.l = function(url, done, key, chunkId) { 160 | /******/ if(inProgress[url]) { inProgress[url].push(done); return; } 161 | /******/ var script, needAttach; 162 | /******/ if(key !== undefined) { 163 | /******/ var scripts = document.getElementsByTagName("script"); 164 | /******/ for(var i = 0; i < scripts.length; i++) { 165 | /******/ var s = scripts[i]; 166 | /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; } 167 | /******/ } 168 | /******/ } 169 | /******/ if(!script) { 170 | /******/ needAttach = true; 171 | /******/ script = document.createElement('script'); 172 | /******/ 173 | /******/ script.charset = 'utf-8'; 174 | /******/ script.timeout = 120; 175 | /******/ if (__webpack_require__.nc) { 176 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 177 | /******/ } 178 | /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key); 179 | /******/ script.src = __webpack_require__.tu(url); 180 | /******/ } 181 | /******/ inProgress[url] = [done]; 182 | /******/ var onScriptComplete = function(prev, event) { 183 | /******/ // avoid mem leaks in IE. 184 | /******/ script.onerror = script.onload = null; 185 | /******/ clearTimeout(timeout); 186 | /******/ var doneFns = inProgress[url]; 187 | /******/ delete inProgress[url]; 188 | /******/ script.parentNode && script.parentNode.removeChild(script); 189 | /******/ doneFns && doneFns.forEach(function(fn) { return fn(event); }); 190 | /******/ if(prev) return prev(event); 191 | /******/ } 192 | /******/ ; 193 | /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000); 194 | /******/ script.onerror = onScriptComplete.bind(null, script.onerror); 195 | /******/ script.onload = onScriptComplete.bind(null, script.onload); 196 | /******/ needAttach && document.head.appendChild(script); 197 | /******/ }; 198 | /******/ }(); 199 | /******/ 200 | /******/ /* webpack/runtime/make namespace object */ 201 | /******/ !function() { 202 | /******/ // define __esModule on exports 203 | /******/ __webpack_require__.r = function(exports) { 204 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 205 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 206 | /******/ } 207 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 208 | /******/ }; 209 | /******/ }(); 210 | /******/ 211 | /******/ /* webpack/runtime/node module decorator */ 212 | /******/ !function() { 213 | /******/ __webpack_require__.nmd = function(module) { 214 | /******/ module.paths = []; 215 | /******/ if (!module.children) module.children = []; 216 | /******/ return module; 217 | /******/ }; 218 | /******/ }(); 219 | /******/ 220 | /******/ /* webpack/runtime/runtimeId */ 221 | /******/ !function() { 222 | /******/ __webpack_require__.j = "webpack"; 223 | /******/ }(); 224 | /******/ 225 | /******/ /* webpack/runtime/trusted types policy */ 226 | /******/ !function() { 227 | /******/ var policy; 228 | /******/ __webpack_require__.tt = function() { 229 | /******/ // Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet. 230 | /******/ if (policy === undefined) { 231 | /******/ policy = { 232 | /******/ createScript: function(script) { return script; }, 233 | /******/ createScriptURL: function(url) { return url; } 234 | /******/ }; 235 | /******/ if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) { 236 | /******/ policy = trustedTypes.createPolicy("nextjs#bundler", policy); 237 | /******/ } 238 | /******/ } 239 | /******/ return policy; 240 | /******/ }; 241 | /******/ }(); 242 | /******/ 243 | /******/ /* webpack/runtime/trusted types script */ 244 | /******/ !function() { 245 | /******/ __webpack_require__.ts = function(script) { return __webpack_require__.tt().createScript(script); }; 246 | /******/ }(); 247 | /******/ 248 | /******/ /* webpack/runtime/trusted types script url */ 249 | /******/ !function() { 250 | /******/ __webpack_require__.tu = function(url) { return __webpack_require__.tt().createScriptURL(url); }; 251 | /******/ }(); 252 | /******/ 253 | /******/ /* webpack/runtime/hot module replacement */ 254 | /******/ !function() { 255 | /******/ var currentModuleData = {}; 256 | /******/ var installedModules = __webpack_require__.c; 257 | /******/ 258 | /******/ // module and require creation 259 | /******/ var currentChildModule; 260 | /******/ var currentParents = []; 261 | /******/ 262 | /******/ // status 263 | /******/ var registeredStatusHandlers = []; 264 | /******/ var currentStatus = "idle"; 265 | /******/ 266 | /******/ // while downloading 267 | /******/ var blockingPromises = 0; 268 | /******/ var blockingPromisesWaiting = []; 269 | /******/ 270 | /******/ // The update info 271 | /******/ var currentUpdateApplyHandlers; 272 | /******/ var queuedInvalidatedModules; 273 | /******/ 274 | /******/ // eslint-disable-next-line no-unused-vars 275 | /******/ __webpack_require__.hmrD = currentModuleData; 276 | /******/ 277 | /******/ __webpack_require__.i.push(function (options) { 278 | /******/ var module = options.module; 279 | /******/ var require = createRequire(options.require, options.id); 280 | /******/ module.hot = createModuleHotObject(options.id, module); 281 | /******/ module.parents = currentParents; 282 | /******/ module.children = []; 283 | /******/ currentParents = []; 284 | /******/ options.require = require; 285 | /******/ }); 286 | /******/ 287 | /******/ __webpack_require__.hmrC = {}; 288 | /******/ __webpack_require__.hmrI = {}; 289 | /******/ 290 | /******/ function createRequire(require, moduleId) { 291 | /******/ var me = installedModules[moduleId]; 292 | /******/ if (!me) return require; 293 | /******/ var fn = function (request) { 294 | /******/ if (me.hot.active) { 295 | /******/ if (installedModules[request]) { 296 | /******/ var parents = installedModules[request].parents; 297 | /******/ if (parents.indexOf(moduleId) === -1) { 298 | /******/ parents.push(moduleId); 299 | /******/ } 300 | /******/ } else { 301 | /******/ currentParents = [moduleId]; 302 | /******/ currentChildModule = request; 303 | /******/ } 304 | /******/ if (me.children.indexOf(request) === -1) { 305 | /******/ me.children.push(request); 306 | /******/ } 307 | /******/ } else { 308 | /******/ console.warn( 309 | /******/ "[HMR] unexpected require(" + 310 | /******/ request + 311 | /******/ ") from disposed module " + 312 | /******/ moduleId 313 | /******/ ); 314 | /******/ currentParents = []; 315 | /******/ } 316 | /******/ return require(request); 317 | /******/ }; 318 | /******/ var createPropertyDescriptor = function (name) { 319 | /******/ return { 320 | /******/ configurable: true, 321 | /******/ enumerable: true, 322 | /******/ get: function () { 323 | /******/ return require[name]; 324 | /******/ }, 325 | /******/ set: function (value) { 326 | /******/ require[name] = value; 327 | /******/ } 328 | /******/ }; 329 | /******/ }; 330 | /******/ for (var name in require) { 331 | /******/ if (Object.prototype.hasOwnProperty.call(require, name) && name !== "e") { 332 | /******/ Object.defineProperty(fn, name, createPropertyDescriptor(name)); 333 | /******/ } 334 | /******/ } 335 | /******/ fn.e = function (chunkId) { 336 | /******/ return trackBlockingPromise(require.e(chunkId)); 337 | /******/ }; 338 | /******/ return fn; 339 | /******/ } 340 | /******/ 341 | /******/ function createModuleHotObject(moduleId, me) { 342 | /******/ var _main = currentChildModule !== moduleId; 343 | /******/ var hot = { 344 | /******/ // private stuff 345 | /******/ _acceptedDependencies: {}, 346 | /******/ _acceptedErrorHandlers: {}, 347 | /******/ _declinedDependencies: {}, 348 | /******/ _selfAccepted: false, 349 | /******/ _selfDeclined: false, 350 | /******/ _selfInvalidated: false, 351 | /******/ _disposeHandlers: [], 352 | /******/ _main: _main, 353 | /******/ _requireSelf: function () { 354 | /******/ currentParents = me.parents.slice(); 355 | /******/ currentChildModule = _main ? undefined : moduleId; 356 | /******/ __webpack_require__(moduleId); 357 | /******/ }, 358 | /******/ 359 | /******/ // Module API 360 | /******/ active: true, 361 | /******/ accept: function (dep, callback, errorHandler) { 362 | /******/ if (dep === undefined) hot._selfAccepted = true; 363 | /******/ else if (typeof dep === "function") hot._selfAccepted = dep; 364 | /******/ else if (typeof dep === "object" && dep !== null) { 365 | /******/ for (var i = 0; i < dep.length; i++) { 366 | /******/ hot._acceptedDependencies[dep[i]] = callback || function () {}; 367 | /******/ hot._acceptedErrorHandlers[dep[i]] = errorHandler; 368 | /******/ } 369 | /******/ } else { 370 | /******/ hot._acceptedDependencies[dep] = callback || function () {}; 371 | /******/ hot._acceptedErrorHandlers[dep] = errorHandler; 372 | /******/ } 373 | /******/ }, 374 | /******/ decline: function (dep) { 375 | /******/ if (dep === undefined) hot._selfDeclined = true; 376 | /******/ else if (typeof dep === "object" && dep !== null) 377 | /******/ for (var i = 0; i < dep.length; i++) 378 | /******/ hot._declinedDependencies[dep[i]] = true; 379 | /******/ else hot._declinedDependencies[dep] = true; 380 | /******/ }, 381 | /******/ dispose: function (callback) { 382 | /******/ hot._disposeHandlers.push(callback); 383 | /******/ }, 384 | /******/ addDisposeHandler: function (callback) { 385 | /******/ hot._disposeHandlers.push(callback); 386 | /******/ }, 387 | /******/ removeDisposeHandler: function (callback) { 388 | /******/ var idx = hot._disposeHandlers.indexOf(callback); 389 | /******/ if (idx >= 0) hot._disposeHandlers.splice(idx, 1); 390 | /******/ }, 391 | /******/ invalidate: function () { 392 | /******/ this._selfInvalidated = true; 393 | /******/ switch (currentStatus) { 394 | /******/ case "idle": 395 | /******/ currentUpdateApplyHandlers = []; 396 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) { 397 | /******/ __webpack_require__.hmrI[key]( 398 | /******/ moduleId, 399 | /******/ currentUpdateApplyHandlers 400 | /******/ ); 401 | /******/ }); 402 | /******/ setStatus("ready"); 403 | /******/ break; 404 | /******/ case "ready": 405 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) { 406 | /******/ __webpack_require__.hmrI[key]( 407 | /******/ moduleId, 408 | /******/ currentUpdateApplyHandlers 409 | /******/ ); 410 | /******/ }); 411 | /******/ break; 412 | /******/ case "prepare": 413 | /******/ case "check": 414 | /******/ case "dispose": 415 | /******/ case "apply": 416 | /******/ (queuedInvalidatedModules = queuedInvalidatedModules || []).push( 417 | /******/ moduleId 418 | /******/ ); 419 | /******/ break; 420 | /******/ default: 421 | /******/ // ignore requests in error states 422 | /******/ break; 423 | /******/ } 424 | /******/ }, 425 | /******/ 426 | /******/ // Management API 427 | /******/ check: hotCheck, 428 | /******/ apply: hotApply, 429 | /******/ status: function (l) { 430 | /******/ if (!l) return currentStatus; 431 | /******/ registeredStatusHandlers.push(l); 432 | /******/ }, 433 | /******/ addStatusHandler: function (l) { 434 | /******/ registeredStatusHandlers.push(l); 435 | /******/ }, 436 | /******/ removeStatusHandler: function (l) { 437 | /******/ var idx = registeredStatusHandlers.indexOf(l); 438 | /******/ if (idx >= 0) registeredStatusHandlers.splice(idx, 1); 439 | /******/ }, 440 | /******/ 441 | /******/ //inherit from previous dispose call 442 | /******/ data: currentModuleData[moduleId] 443 | /******/ }; 444 | /******/ currentChildModule = undefined; 445 | /******/ return hot; 446 | /******/ } 447 | /******/ 448 | /******/ function setStatus(newStatus) { 449 | /******/ currentStatus = newStatus; 450 | /******/ var results = []; 451 | /******/ 452 | /******/ for (var i = 0; i < registeredStatusHandlers.length; i++) 453 | /******/ results[i] = registeredStatusHandlers[i].call(null, newStatus); 454 | /******/ 455 | /******/ return Promise.all(results); 456 | /******/ } 457 | /******/ 458 | /******/ function unblock() { 459 | /******/ if (--blockingPromises === 0) { 460 | /******/ setStatus("ready").then(function () { 461 | /******/ if (blockingPromises === 0) { 462 | /******/ var list = blockingPromisesWaiting; 463 | /******/ blockingPromisesWaiting = []; 464 | /******/ for (var i = 0; i < list.length; i++) { 465 | /******/ list[i](); 466 | /******/ } 467 | /******/ } 468 | /******/ }); 469 | /******/ } 470 | /******/ } 471 | /******/ 472 | /******/ function trackBlockingPromise(promise) { 473 | /******/ switch (currentStatus) { 474 | /******/ case "ready": 475 | /******/ setStatus("prepare"); 476 | /******/ /* fallthrough */ 477 | /******/ case "prepare": 478 | /******/ blockingPromises++; 479 | /******/ promise.then(unblock, unblock); 480 | /******/ return promise; 481 | /******/ default: 482 | /******/ return promise; 483 | /******/ } 484 | /******/ } 485 | /******/ 486 | /******/ function waitForBlockingPromises(fn) { 487 | /******/ if (blockingPromises === 0) return fn(); 488 | /******/ return new Promise(function (resolve) { 489 | /******/ blockingPromisesWaiting.push(function () { 490 | /******/ resolve(fn()); 491 | /******/ }); 492 | /******/ }); 493 | /******/ } 494 | /******/ 495 | /******/ function hotCheck(applyOnUpdate) { 496 | /******/ if (currentStatus !== "idle") { 497 | /******/ throw new Error("check() is only allowed in idle status"); 498 | /******/ } 499 | /******/ return setStatus("check") 500 | /******/ .then(__webpack_require__.hmrM) 501 | /******/ .then(function (update) { 502 | /******/ if (!update) { 503 | /******/ return setStatus(applyInvalidatedModules() ? "ready" : "idle").then( 504 | /******/ function () { 505 | /******/ return null; 506 | /******/ } 507 | /******/ ); 508 | /******/ } 509 | /******/ 510 | /******/ return setStatus("prepare").then(function () { 511 | /******/ var updatedModules = []; 512 | /******/ currentUpdateApplyHandlers = []; 513 | /******/ 514 | /******/ return Promise.all( 515 | /******/ Object.keys(__webpack_require__.hmrC).reduce(function ( 516 | /******/ promises, 517 | /******/ key 518 | /******/ ) { 519 | /******/ __webpack_require__.hmrC[key]( 520 | /******/ update.c, 521 | /******/ update.r, 522 | /******/ update.m, 523 | /******/ promises, 524 | /******/ currentUpdateApplyHandlers, 525 | /******/ updatedModules 526 | /******/ ); 527 | /******/ return promises; 528 | /******/ }, 529 | /******/ []) 530 | /******/ ).then(function () { 531 | /******/ return waitForBlockingPromises(function () { 532 | /******/ if (applyOnUpdate) { 533 | /******/ return internalApply(applyOnUpdate); 534 | /******/ } else { 535 | /******/ return setStatus("ready").then(function () { 536 | /******/ return updatedModules; 537 | /******/ }); 538 | /******/ } 539 | /******/ }); 540 | /******/ }); 541 | /******/ }); 542 | /******/ }); 543 | /******/ } 544 | /******/ 545 | /******/ function hotApply(options) { 546 | /******/ if (currentStatus !== "ready") { 547 | /******/ return Promise.resolve().then(function () { 548 | /******/ throw new Error( 549 | /******/ "apply() is only allowed in ready status (state: " + 550 | /******/ currentStatus + 551 | /******/ ")" 552 | /******/ ); 553 | /******/ }); 554 | /******/ } 555 | /******/ return internalApply(options); 556 | /******/ } 557 | /******/ 558 | /******/ function internalApply(options) { 559 | /******/ options = options || {}; 560 | /******/ 561 | /******/ applyInvalidatedModules(); 562 | /******/ 563 | /******/ var results = currentUpdateApplyHandlers.map(function (handler) { 564 | /******/ return handler(options); 565 | /******/ }); 566 | /******/ currentUpdateApplyHandlers = undefined; 567 | /******/ 568 | /******/ var errors = results 569 | /******/ .map(function (r) { 570 | /******/ return r.error; 571 | /******/ }) 572 | /******/ .filter(Boolean); 573 | /******/ 574 | /******/ if (errors.length > 0) { 575 | /******/ return setStatus("abort").then(function () { 576 | /******/ throw errors[0]; 577 | /******/ }); 578 | /******/ } 579 | /******/ 580 | /******/ // Now in "dispose" phase 581 | /******/ var disposePromise = setStatus("dispose"); 582 | /******/ 583 | /******/ results.forEach(function (result) { 584 | /******/ if (result.dispose) result.dispose(); 585 | /******/ }); 586 | /******/ 587 | /******/ // Now in "apply" phase 588 | /******/ var applyPromise = setStatus("apply"); 589 | /******/ 590 | /******/ var error; 591 | /******/ var reportError = function (err) { 592 | /******/ if (!error) error = err; 593 | /******/ }; 594 | /******/ 595 | /******/ var outdatedModules = []; 596 | /******/ results.forEach(function (result) { 597 | /******/ if (result.apply) { 598 | /******/ var modules = result.apply(reportError); 599 | /******/ if (modules) { 600 | /******/ for (var i = 0; i < modules.length; i++) { 601 | /******/ outdatedModules.push(modules[i]); 602 | /******/ } 603 | /******/ } 604 | /******/ } 605 | /******/ }); 606 | /******/ 607 | /******/ return Promise.all([disposePromise, applyPromise]).then(function () { 608 | /******/ // handle errors in accept handlers and self accepted module load 609 | /******/ if (error) { 610 | /******/ return setStatus("fail").then(function () { 611 | /******/ throw error; 612 | /******/ }); 613 | /******/ } 614 | /******/ 615 | /******/ if (queuedInvalidatedModules) { 616 | /******/ return internalApply(options).then(function (list) { 617 | /******/ outdatedModules.forEach(function (moduleId) { 618 | /******/ if (list.indexOf(moduleId) < 0) list.push(moduleId); 619 | /******/ }); 620 | /******/ return list; 621 | /******/ }); 622 | /******/ } 623 | /******/ 624 | /******/ return setStatus("idle").then(function () { 625 | /******/ return outdatedModules; 626 | /******/ }); 627 | /******/ }); 628 | /******/ } 629 | /******/ 630 | /******/ function applyInvalidatedModules() { 631 | /******/ if (queuedInvalidatedModules) { 632 | /******/ if (!currentUpdateApplyHandlers) currentUpdateApplyHandlers = []; 633 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) { 634 | /******/ queuedInvalidatedModules.forEach(function (moduleId) { 635 | /******/ __webpack_require__.hmrI[key]( 636 | /******/ moduleId, 637 | /******/ currentUpdateApplyHandlers 638 | /******/ ); 639 | /******/ }); 640 | /******/ }); 641 | /******/ queuedInvalidatedModules = undefined; 642 | /******/ return true; 643 | /******/ } 644 | /******/ } 645 | /******/ }(); 646 | /******/ 647 | /******/ /* webpack/runtime/publicPath */ 648 | /******/ !function() { 649 | /******/ __webpack_require__.p = "/_next/"; 650 | /******/ }(); 651 | /******/ 652 | /******/ /* webpack/runtime/react refresh */ 653 | /******/ !function() { 654 | /******/ if (__webpack_require__.i) { 655 | /******/ __webpack_require__.i.push(function(options) { 656 | /******/ var originalFactory = options.factory; 657 | /******/ options.factory = function(moduleObject, moduleExports, webpackRequire) { 658 | /******/ var hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$; 659 | /******/ var cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : function() {}; 660 | /******/ try { 661 | /******/ originalFactory.call(this, moduleObject, moduleExports, webpackRequire); 662 | /******/ } finally { 663 | /******/ cleanup(); 664 | /******/ } 665 | /******/ } 666 | /******/ }) 667 | /******/ } 668 | /******/ }(); 669 | /******/ 670 | /******/ /* webpack/runtime/compat */ 671 | /******/ 672 | /******/ 673 | /******/ // noop fns to prevent runtime errors during initialization 674 | /******/ if (typeof self !== "undefined") { 675 | /******/ self.$RefreshReg$ = function () {}; 676 | /******/ self.$RefreshSig$ = function () { 677 | /******/ return function (type) { 678 | /******/ return type; 679 | /******/ }; 680 | /******/ }; 681 | /******/ } 682 | /******/ 683 | /******/ /* webpack/runtime/jsonp chunk loading */ 684 | /******/ !function() { 685 | /******/ // no baseURI 686 | /******/ 687 | /******/ // object to store loaded and loading chunks 688 | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 689 | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 690 | /******/ var installedChunks = __webpack_require__.hmrS_jsonp = __webpack_require__.hmrS_jsonp || { 691 | /******/ "webpack": 0 692 | /******/ }; 693 | /******/ 694 | /******/ // no chunk on demand loading 695 | /******/ 696 | /******/ // no prefetching 697 | /******/ 698 | /******/ // no preloaded 699 | /******/ 700 | /******/ var currentUpdatedModulesList; 701 | /******/ var waitingUpdateResolves = {}; 702 | /******/ function loadUpdateChunk(chunkId, updatedModulesList) { 703 | /******/ currentUpdatedModulesList = updatedModulesList; 704 | /******/ return new Promise(function(resolve, reject) { 705 | /******/ waitingUpdateResolves[chunkId] = resolve; 706 | /******/ // start update chunk loading 707 | /******/ var url = __webpack_require__.p + __webpack_require__.hu(chunkId); 708 | /******/ // create error before stack unwound to get useful stacktrace later 709 | /******/ var error = new Error(); 710 | /******/ var loadingEnded = function(event) { 711 | /******/ if(waitingUpdateResolves[chunkId]) { 712 | /******/ waitingUpdateResolves[chunkId] = undefined 713 | /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); 714 | /******/ var realSrc = event && event.target && event.target.src; 715 | /******/ error.message = 'Loading hot update chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; 716 | /******/ error.name = 'ChunkLoadError'; 717 | /******/ error.type = errorType; 718 | /******/ error.request = realSrc; 719 | /******/ reject(error); 720 | /******/ } 721 | /******/ }; 722 | /******/ __webpack_require__.l(url, loadingEnded); 723 | /******/ }); 724 | /******/ } 725 | /******/ 726 | /******/ self["webpackHotUpdate_N_E"] = function(chunkId, moreModules, runtime) { 727 | /******/ for(var moduleId in moreModules) { 728 | /******/ if(__webpack_require__.o(moreModules, moduleId)) { 729 | /******/ currentUpdate[moduleId] = moreModules[moduleId]; 730 | /******/ if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId); 731 | /******/ } 732 | /******/ } 733 | /******/ if(runtime) currentUpdateRuntime.push(runtime); 734 | /******/ if(waitingUpdateResolves[chunkId]) { 735 | /******/ waitingUpdateResolves[chunkId](); 736 | /******/ waitingUpdateResolves[chunkId] = undefined; 737 | /******/ } 738 | /******/ }; 739 | /******/ 740 | /******/ var currentUpdateChunks; 741 | /******/ var currentUpdate; 742 | /******/ var currentUpdateRemovedChunks; 743 | /******/ var currentUpdateRuntime; 744 | /******/ function applyHandler(options) { 745 | /******/ if (__webpack_require__.f) delete __webpack_require__.f.jsonpHmr; 746 | /******/ currentUpdateChunks = undefined; 747 | /******/ function getAffectedModuleEffects(updateModuleId) { 748 | /******/ var outdatedModules = [updateModuleId]; 749 | /******/ var outdatedDependencies = {}; 750 | /******/ 751 | /******/ var queue = outdatedModules.map(function (id) { 752 | /******/ return { 753 | /******/ chain: [id], 754 | /******/ id: id 755 | /******/ }; 756 | /******/ }); 757 | /******/ while (queue.length > 0) { 758 | /******/ var queueItem = queue.pop(); 759 | /******/ var moduleId = queueItem.id; 760 | /******/ var chain = queueItem.chain; 761 | /******/ var module = __webpack_require__.c[moduleId]; 762 | /******/ if ( 763 | /******/ !module || 764 | /******/ (module.hot._selfAccepted && !module.hot._selfInvalidated) 765 | /******/ ) 766 | /******/ continue; 767 | /******/ if (module.hot._selfDeclined) { 768 | /******/ return { 769 | /******/ type: "self-declined", 770 | /******/ chain: chain, 771 | /******/ moduleId: moduleId 772 | /******/ }; 773 | /******/ } 774 | /******/ if (module.hot._main) { 775 | /******/ return { 776 | /******/ type: "unaccepted", 777 | /******/ chain: chain, 778 | /******/ moduleId: moduleId 779 | /******/ }; 780 | /******/ } 781 | /******/ for (var i = 0; i < module.parents.length; i++) { 782 | /******/ var parentId = module.parents[i]; 783 | /******/ var parent = __webpack_require__.c[parentId]; 784 | /******/ if (!parent) continue; 785 | /******/ if (parent.hot._declinedDependencies[moduleId]) { 786 | /******/ return { 787 | /******/ type: "declined", 788 | /******/ chain: chain.concat([parentId]), 789 | /******/ moduleId: moduleId, 790 | /******/ parentId: parentId 791 | /******/ }; 792 | /******/ } 793 | /******/ if (outdatedModules.indexOf(parentId) !== -1) continue; 794 | /******/ if (parent.hot._acceptedDependencies[moduleId]) { 795 | /******/ if (!outdatedDependencies[parentId]) 796 | /******/ outdatedDependencies[parentId] = []; 797 | /******/ addAllToSet(outdatedDependencies[parentId], [moduleId]); 798 | /******/ continue; 799 | /******/ } 800 | /******/ delete outdatedDependencies[parentId]; 801 | /******/ outdatedModules.push(parentId); 802 | /******/ queue.push({ 803 | /******/ chain: chain.concat([parentId]), 804 | /******/ id: parentId 805 | /******/ }); 806 | /******/ } 807 | /******/ } 808 | /******/ 809 | /******/ return { 810 | /******/ type: "accepted", 811 | /******/ moduleId: updateModuleId, 812 | /******/ outdatedModules: outdatedModules, 813 | /******/ outdatedDependencies: outdatedDependencies 814 | /******/ }; 815 | /******/ } 816 | /******/ 817 | /******/ function addAllToSet(a, b) { 818 | /******/ for (var i = 0; i < b.length; i++) { 819 | /******/ var item = b[i]; 820 | /******/ if (a.indexOf(item) === -1) a.push(item); 821 | /******/ } 822 | /******/ } 823 | /******/ 824 | /******/ // at begin all updates modules are outdated 825 | /******/ // the "outdated" status can propagate to parents if they don't accept the children 826 | /******/ var outdatedDependencies = {}; 827 | /******/ var outdatedModules = []; 828 | /******/ var appliedUpdate = {}; 829 | /******/ 830 | /******/ var warnUnexpectedRequire = function warnUnexpectedRequire(module) { 831 | /******/ console.warn( 832 | /******/ "[HMR] unexpected require(" + module.id + ") to disposed module" 833 | /******/ ); 834 | /******/ }; 835 | /******/ 836 | /******/ for (var moduleId in currentUpdate) { 837 | /******/ if (__webpack_require__.o(currentUpdate, moduleId)) { 838 | /******/ var newModuleFactory = currentUpdate[moduleId]; 839 | /******/ /** @type {TODO} */ 840 | /******/ var result; 841 | /******/ if (newModuleFactory) { 842 | /******/ result = getAffectedModuleEffects(moduleId); 843 | /******/ } else { 844 | /******/ result = { 845 | /******/ type: "disposed", 846 | /******/ moduleId: moduleId 847 | /******/ }; 848 | /******/ } 849 | /******/ /** @type {Error|false} */ 850 | /******/ var abortError = false; 851 | /******/ var doApply = false; 852 | /******/ var doDispose = false; 853 | /******/ var chainInfo = ""; 854 | /******/ if (result.chain) { 855 | /******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> "); 856 | /******/ } 857 | /******/ switch (result.type) { 858 | /******/ case "self-declined": 859 | /******/ if (options.onDeclined) options.onDeclined(result); 860 | /******/ if (!options.ignoreDeclined) 861 | /******/ abortError = new Error( 862 | /******/ "Aborted because of self decline: " + 863 | /******/ result.moduleId + 864 | /******/ chainInfo 865 | /******/ ); 866 | /******/ break; 867 | /******/ case "declined": 868 | /******/ if (options.onDeclined) options.onDeclined(result); 869 | /******/ if (!options.ignoreDeclined) 870 | /******/ abortError = new Error( 871 | /******/ "Aborted because of declined dependency: " + 872 | /******/ result.moduleId + 873 | /******/ " in " + 874 | /******/ result.parentId + 875 | /******/ chainInfo 876 | /******/ ); 877 | /******/ break; 878 | /******/ case "unaccepted": 879 | /******/ if (options.onUnaccepted) options.onUnaccepted(result); 880 | /******/ if (!options.ignoreUnaccepted) 881 | /******/ abortError = new Error( 882 | /******/ "Aborted because " + moduleId + " is not accepted" + chainInfo 883 | /******/ ); 884 | /******/ break; 885 | /******/ case "accepted": 886 | /******/ if (options.onAccepted) options.onAccepted(result); 887 | /******/ doApply = true; 888 | /******/ break; 889 | /******/ case "disposed": 890 | /******/ if (options.onDisposed) options.onDisposed(result); 891 | /******/ doDispose = true; 892 | /******/ break; 893 | /******/ default: 894 | /******/ throw new Error("Unexception type " + result.type); 895 | /******/ } 896 | /******/ if (abortError) { 897 | /******/ return { 898 | /******/ error: abortError 899 | /******/ }; 900 | /******/ } 901 | /******/ if (doApply) { 902 | /******/ appliedUpdate[moduleId] = newModuleFactory; 903 | /******/ addAllToSet(outdatedModules, result.outdatedModules); 904 | /******/ for (moduleId in result.outdatedDependencies) { 905 | /******/ if (__webpack_require__.o(result.outdatedDependencies, moduleId)) { 906 | /******/ if (!outdatedDependencies[moduleId]) 907 | /******/ outdatedDependencies[moduleId] = []; 908 | /******/ addAllToSet( 909 | /******/ outdatedDependencies[moduleId], 910 | /******/ result.outdatedDependencies[moduleId] 911 | /******/ ); 912 | /******/ } 913 | /******/ } 914 | /******/ } 915 | /******/ if (doDispose) { 916 | /******/ addAllToSet(outdatedModules, [result.moduleId]); 917 | /******/ appliedUpdate[moduleId] = warnUnexpectedRequire; 918 | /******/ } 919 | /******/ } 920 | /******/ } 921 | /******/ currentUpdate = undefined; 922 | /******/ 923 | /******/ // Store self accepted outdated modules to require them later by the module system 924 | /******/ var outdatedSelfAcceptedModules = []; 925 | /******/ for (var j = 0; j < outdatedModules.length; j++) { 926 | /******/ var outdatedModuleId = outdatedModules[j]; 927 | /******/ var module = __webpack_require__.c[outdatedModuleId]; 928 | /******/ if ( 929 | /******/ module && 930 | /******/ (module.hot._selfAccepted || module.hot._main) && 931 | /******/ // removed self-accepted modules should not be required 932 | /******/ appliedUpdate[outdatedModuleId] !== warnUnexpectedRequire && 933 | /******/ // when called invalidate self-accepting is not possible 934 | /******/ !module.hot._selfInvalidated 935 | /******/ ) { 936 | /******/ outdatedSelfAcceptedModules.push({ 937 | /******/ module: outdatedModuleId, 938 | /******/ require: module.hot._requireSelf, 939 | /******/ errorHandler: module.hot._selfAccepted 940 | /******/ }); 941 | /******/ } 942 | /******/ } 943 | /******/ 944 | /******/ var moduleOutdatedDependencies; 945 | /******/ 946 | /******/ return { 947 | /******/ dispose: function () { 948 | /******/ currentUpdateRemovedChunks.forEach(function (chunkId) { 949 | /******/ delete installedChunks[chunkId]; 950 | /******/ }); 951 | /******/ currentUpdateRemovedChunks = undefined; 952 | /******/ 953 | /******/ var idx; 954 | /******/ var queue = outdatedModules.slice(); 955 | /******/ while (queue.length > 0) { 956 | /******/ var moduleId = queue.pop(); 957 | /******/ var module = __webpack_require__.c[moduleId]; 958 | /******/ if (!module) continue; 959 | /******/ 960 | /******/ var data = {}; 961 | /******/ 962 | /******/ // Call dispose handlers 963 | /******/ var disposeHandlers = module.hot._disposeHandlers; 964 | /******/ for (j = 0; j < disposeHandlers.length; j++) { 965 | /******/ disposeHandlers[j].call(null, data); 966 | /******/ } 967 | /******/ __webpack_require__.hmrD[moduleId] = data; 968 | /******/ 969 | /******/ // disable module (this disables requires from this module) 970 | /******/ module.hot.active = false; 971 | /******/ 972 | /******/ // remove module from cache 973 | /******/ delete __webpack_require__.c[moduleId]; 974 | /******/ 975 | /******/ // when disposing there is no need to call dispose handler 976 | /******/ delete outdatedDependencies[moduleId]; 977 | /******/ 978 | /******/ // remove "parents" references from all children 979 | /******/ for (j = 0; j < module.children.length; j++) { 980 | /******/ var child = __webpack_require__.c[module.children[j]]; 981 | /******/ if (!child) continue; 982 | /******/ idx = child.parents.indexOf(moduleId); 983 | /******/ if (idx >= 0) { 984 | /******/ child.parents.splice(idx, 1); 985 | /******/ } 986 | /******/ } 987 | /******/ } 988 | /******/ 989 | /******/ // remove outdated dependency from module children 990 | /******/ var dependency; 991 | /******/ for (var outdatedModuleId in outdatedDependencies) { 992 | /******/ if (__webpack_require__.o(outdatedDependencies, outdatedModuleId)) { 993 | /******/ module = __webpack_require__.c[outdatedModuleId]; 994 | /******/ if (module) { 995 | /******/ moduleOutdatedDependencies = 996 | /******/ outdatedDependencies[outdatedModuleId]; 997 | /******/ for (j = 0; j < moduleOutdatedDependencies.length; j++) { 998 | /******/ dependency = moduleOutdatedDependencies[j]; 999 | /******/ idx = module.children.indexOf(dependency); 1000 | /******/ if (idx >= 0) module.children.splice(idx, 1); 1001 | /******/ } 1002 | /******/ } 1003 | /******/ } 1004 | /******/ } 1005 | /******/ }, 1006 | /******/ apply: function (reportError) { 1007 | /******/ // insert new code 1008 | /******/ for (var updateModuleId in appliedUpdate) { 1009 | /******/ if (__webpack_require__.o(appliedUpdate, updateModuleId)) { 1010 | /******/ __webpack_require__.m[updateModuleId] = appliedUpdate[updateModuleId]; 1011 | /******/ } 1012 | /******/ } 1013 | /******/ 1014 | /******/ // run new runtime modules 1015 | /******/ for (var i = 0; i < currentUpdateRuntime.length; i++) { 1016 | /******/ currentUpdateRuntime[i](__webpack_require__); 1017 | /******/ } 1018 | /******/ 1019 | /******/ // call accept handlers 1020 | /******/ for (var outdatedModuleId in outdatedDependencies) { 1021 | /******/ if (__webpack_require__.o(outdatedDependencies, outdatedModuleId)) { 1022 | /******/ var module = __webpack_require__.c[outdatedModuleId]; 1023 | /******/ if (module) { 1024 | /******/ moduleOutdatedDependencies = 1025 | /******/ outdatedDependencies[outdatedModuleId]; 1026 | /******/ var callbacks = []; 1027 | /******/ var errorHandlers = []; 1028 | /******/ var dependenciesForCallbacks = []; 1029 | /******/ for (var j = 0; j < moduleOutdatedDependencies.length; j++) { 1030 | /******/ var dependency = moduleOutdatedDependencies[j]; 1031 | /******/ var acceptCallback = 1032 | /******/ module.hot._acceptedDependencies[dependency]; 1033 | /******/ var errorHandler = 1034 | /******/ module.hot._acceptedErrorHandlers[dependency]; 1035 | /******/ if (acceptCallback) { 1036 | /******/ if (callbacks.indexOf(acceptCallback) !== -1) continue; 1037 | /******/ callbacks.push(acceptCallback); 1038 | /******/ errorHandlers.push(errorHandler); 1039 | /******/ dependenciesForCallbacks.push(dependency); 1040 | /******/ } 1041 | /******/ } 1042 | /******/ for (var k = 0; k < callbacks.length; k++) { 1043 | /******/ try { 1044 | /******/ callbacks[k].call(null, moduleOutdatedDependencies); 1045 | /******/ } catch (err) { 1046 | /******/ if (typeof errorHandlers[k] === "function") { 1047 | /******/ try { 1048 | /******/ errorHandlers[k](err, { 1049 | /******/ moduleId: outdatedModuleId, 1050 | /******/ dependencyId: dependenciesForCallbacks[k] 1051 | /******/ }); 1052 | /******/ } catch (err2) { 1053 | /******/ if (options.onErrored) { 1054 | /******/ options.onErrored({ 1055 | /******/ type: "accept-error-handler-errored", 1056 | /******/ moduleId: outdatedModuleId, 1057 | /******/ dependencyId: dependenciesForCallbacks[k], 1058 | /******/ error: err2, 1059 | /******/ originalError: err 1060 | /******/ }); 1061 | /******/ } 1062 | /******/ if (!options.ignoreErrored) { 1063 | /******/ reportError(err2); 1064 | /******/ reportError(err); 1065 | /******/ } 1066 | /******/ } 1067 | /******/ } else { 1068 | /******/ if (options.onErrored) { 1069 | /******/ options.onErrored({ 1070 | /******/ type: "accept-errored", 1071 | /******/ moduleId: outdatedModuleId, 1072 | /******/ dependencyId: dependenciesForCallbacks[k], 1073 | /******/ error: err 1074 | /******/ }); 1075 | /******/ } 1076 | /******/ if (!options.ignoreErrored) { 1077 | /******/ reportError(err); 1078 | /******/ } 1079 | /******/ } 1080 | /******/ } 1081 | /******/ } 1082 | /******/ } 1083 | /******/ } 1084 | /******/ } 1085 | /******/ 1086 | /******/ // Load self accepted modules 1087 | /******/ for (var o = 0; o < outdatedSelfAcceptedModules.length; o++) { 1088 | /******/ var item = outdatedSelfAcceptedModules[o]; 1089 | /******/ var moduleId = item.module; 1090 | /******/ try { 1091 | /******/ item.require(moduleId); 1092 | /******/ } catch (err) { 1093 | /******/ if (typeof item.errorHandler === "function") { 1094 | /******/ try { 1095 | /******/ item.errorHandler(err, { 1096 | /******/ moduleId: moduleId, 1097 | /******/ module: __webpack_require__.c[moduleId] 1098 | /******/ }); 1099 | /******/ } catch (err2) { 1100 | /******/ if (options.onErrored) { 1101 | /******/ options.onErrored({ 1102 | /******/ type: "self-accept-error-handler-errored", 1103 | /******/ moduleId: moduleId, 1104 | /******/ error: err2, 1105 | /******/ originalError: err 1106 | /******/ }); 1107 | /******/ } 1108 | /******/ if (!options.ignoreErrored) { 1109 | /******/ reportError(err2); 1110 | /******/ reportError(err); 1111 | /******/ } 1112 | /******/ } 1113 | /******/ } else { 1114 | /******/ if (options.onErrored) { 1115 | /******/ options.onErrored({ 1116 | /******/ type: "self-accept-errored", 1117 | /******/ moduleId: moduleId, 1118 | /******/ error: err 1119 | /******/ }); 1120 | /******/ } 1121 | /******/ if (!options.ignoreErrored) { 1122 | /******/ reportError(err); 1123 | /******/ } 1124 | /******/ } 1125 | /******/ } 1126 | /******/ } 1127 | /******/ 1128 | /******/ return outdatedModules; 1129 | /******/ } 1130 | /******/ }; 1131 | /******/ } 1132 | /******/ __webpack_require__.hmrI.jsonp = function (moduleId, applyHandlers) { 1133 | /******/ if (!currentUpdate) { 1134 | /******/ currentUpdate = {}; 1135 | /******/ currentUpdateRuntime = []; 1136 | /******/ currentUpdateRemovedChunks = []; 1137 | /******/ applyHandlers.push(applyHandler); 1138 | /******/ } 1139 | /******/ if (!__webpack_require__.o(currentUpdate, moduleId)) { 1140 | /******/ currentUpdate[moduleId] = __webpack_require__.m[moduleId]; 1141 | /******/ } 1142 | /******/ }; 1143 | /******/ __webpack_require__.hmrC.jsonp = function ( 1144 | /******/ chunkIds, 1145 | /******/ removedChunks, 1146 | /******/ removedModules, 1147 | /******/ promises, 1148 | /******/ applyHandlers, 1149 | /******/ updatedModulesList 1150 | /******/ ) { 1151 | /******/ applyHandlers.push(applyHandler); 1152 | /******/ currentUpdateChunks = {}; 1153 | /******/ currentUpdateRemovedChunks = removedChunks; 1154 | /******/ currentUpdate = removedModules.reduce(function (obj, key) { 1155 | /******/ obj[key] = false; 1156 | /******/ return obj; 1157 | /******/ }, {}); 1158 | /******/ currentUpdateRuntime = []; 1159 | /******/ chunkIds.forEach(function (chunkId) { 1160 | /******/ if ( 1161 | /******/ __webpack_require__.o(installedChunks, chunkId) && 1162 | /******/ installedChunks[chunkId] !== undefined 1163 | /******/ ) { 1164 | /******/ promises.push(loadUpdateChunk(chunkId, updatedModulesList)); 1165 | /******/ currentUpdateChunks[chunkId] = true; 1166 | /******/ } else { 1167 | /******/ currentUpdateChunks[chunkId] = false; 1168 | /******/ } 1169 | /******/ }); 1170 | /******/ if (__webpack_require__.f) { 1171 | /******/ __webpack_require__.f.jsonpHmr = function (chunkId, promises) { 1172 | /******/ if ( 1173 | /******/ currentUpdateChunks && 1174 | /******/ __webpack_require__.o(currentUpdateChunks, chunkId) && 1175 | /******/ !currentUpdateChunks[chunkId] 1176 | /******/ ) { 1177 | /******/ promises.push(loadUpdateChunk(chunkId)); 1178 | /******/ currentUpdateChunks[chunkId] = true; 1179 | /******/ } 1180 | /******/ }; 1181 | /******/ } 1182 | /******/ }; 1183 | /******/ 1184 | /******/ __webpack_require__.hmrM = function() { 1185 | /******/ if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API"); 1186 | /******/ return fetch(__webpack_require__.p + __webpack_require__.hmrF()).then(function(response) { 1187 | /******/ if(response.status === 404) return; // no update available 1188 | /******/ if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText); 1189 | /******/ return response.json(); 1190 | /******/ }); 1191 | /******/ }; 1192 | /******/ 1193 | /******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; 1194 | /******/ 1195 | /******/ // install a JSONP callback for chunk loading 1196 | /******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { 1197 | /******/ var chunkIds = data[0]; 1198 | /******/ var moreModules = data[1]; 1199 | /******/ var runtime = data[2]; 1200 | /******/ // add "moreModules" to the modules object, 1201 | /******/ // then flag all "chunkIds" as loaded and fire callback 1202 | /******/ var moduleId, chunkId, i = 0; 1203 | /******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { 1204 | /******/ for(moduleId in moreModules) { 1205 | /******/ if(__webpack_require__.o(moreModules, moduleId)) { 1206 | /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 1207 | /******/ } 1208 | /******/ } 1209 | /******/ if(runtime) var result = runtime(__webpack_require__); 1210 | /******/ } 1211 | /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); 1212 | /******/ for(;i < chunkIds.length; i++) { 1213 | /******/ chunkId = chunkIds[i]; 1214 | /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { 1215 | /******/ installedChunks[chunkId][0](); 1216 | /******/ } 1217 | /******/ installedChunks[chunkId] = 0; 1218 | /******/ } 1219 | /******/ return __webpack_require__.O(result); 1220 | /******/ } 1221 | /******/ 1222 | /******/ var chunkLoadingGlobal = self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []; 1223 | /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); 1224 | /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); 1225 | /******/ }(); 1226 | /******/ 1227 | /******/ /* webpack/runtime/nonce */ 1228 | /******/ !function() { 1229 | /******/ __webpack_require__.nc = undefined; 1230 | /******/ }(); 1231 | /******/ 1232 | /************************************************************************/ 1233 | /******/ 1234 | /******/ // module cache are used so entry inlining is disabled 1235 | /******/ 1236 | /******/ })() 1237 | ; -------------------------------------------------------------------------------- /CustomSearchPage/.next/static/development/_buildManifest.js: -------------------------------------------------------------------------------- 1 | self.__BUILD_MANIFEST = {__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],sortedPages:["\u002F_app","\u002F_error"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB() -------------------------------------------------------------------------------- /CustomSearchPage/.next/static/development/_ssgManifest.js: -------------------------------------------------------------------------------- 1 | self.__SSG_MANIFEST=new Set;self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() -------------------------------------------------------------------------------- /CustomSearchPage/assets/Background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FirmanKurniawan/NodeJS-Projects/f520cdd8e4e1163e3414ba5a6692b24ecad95462/CustomSearchPage/assets/Background.png -------------------------------------------------------------------------------- /CustomSearchPage/assets/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FirmanKurniawan/NodeJS-Projects/f520cdd8e4e1163e3414ba5a6692b24ecad95462/CustomSearchPage/assets/header.png -------------------------------------------------------------------------------- /CustomSearchPage/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /CustomSearchPage/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | swcMinify: true, 5 | } 6 | 7 | module.exports = nextConfig 8 | -------------------------------------------------------------------------------- /CustomSearchPage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-startpage", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "next": "12.3.1", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "18.8.4", 18 | "@types/react": "18.0.21", 19 | "@types/react-dom": "18.0.6", 20 | "eslint": "8.25.0", 21 | "eslint-config-next": "12.3.1", 22 | "typescript": "4.8.4" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CustomSearchPage/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import '../styles/globals.css' 2 | import type { AppProps } from 'next/app' 3 | 4 | function MyApp({ Component, pageProps }: AppProps) { 5 | return 6 | } 7 | 8 | export default MyApp 9 | -------------------------------------------------------------------------------- /CustomSearchPage/pages/api/hello.ts: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | import type { NextApiRequest, NextApiResponse } from 'next' 3 | 4 | type Data = { 5 | name: string 6 | } 7 | 8 | export default function handler( 9 | req: NextApiRequest, 10 | res: NextApiResponse 11 | ) { 12 | res.status(200).json({ name: 'John Doe' }) 13 | } 14 | -------------------------------------------------------------------------------- /CustomSearchPage/pages/components/landingPage.tsx: -------------------------------------------------------------------------------- 1 | import { NextPage } from "next"; 2 | import styles from "../../styles/Startup.module.css" 3 | import Image from 'next/image' 4 | import banner from '../../assets/header.png' 5 | 6 | 7 | 8 | const LandingPage: NextPage = () => { 9 | return ( 10 |
11 |
12 |
13 | 16 |
17 |
18 |
19 |
20 | 21 |
22 |
23 |
24 |
  • blog
  • 25 |
  • linkedin
  • 26 |
  • github
  • 27 |
    28 |
    29 | ) 30 | } 31 | 32 | export default LandingPage; 33 | -------------------------------------------------------------------------------- /CustomSearchPage/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import type { NextPage } from 'next' 2 | import Head from 'next/head' 3 | import Image from 'next/image' 4 | import styles from '../styles/Home.module.css' 5 | import LandingPage from "./components/landingPage"; 6 | 7 | const Home: NextPage = () => { 8 | return ( 9 |
    10 | 11 | Yuuriya Search! 12 | 13 | 14 | 15 | 16 | 17 | 18 |
    19 | ) 20 | } 21 | 22 | export default Home 23 | -------------------------------------------------------------------------------- /CustomSearchPage/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FirmanKurniawan/NodeJS-Projects/f520cdd8e4e1163e3414ba5a6692b24ecad95462/CustomSearchPage/public/favicon.ico -------------------------------------------------------------------------------- /CustomSearchPage/public/vercel.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /CustomSearchPage/styles/Home.module.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 0 2rem; 3 | } 4 | 5 | .main { 6 | min-height: 100vh; 7 | padding: 4rem 0; 8 | flex: 1; 9 | display: flex; 10 | flex-direction: column; 11 | justify-content: center; 12 | align-items: center; 13 | } 14 | 15 | .footer { 16 | display: flex; 17 | flex: 1; 18 | padding: 2rem 0; 19 | border-top: 1px solid #eaeaea; 20 | justify-content: center; 21 | align-items: center; 22 | } 23 | 24 | .footer a { 25 | display: flex; 26 | justify-content: center; 27 | align-items: center; 28 | flex-grow: 1; 29 | } 30 | 31 | .title a { 32 | color: #0070f3; 33 | text-decoration: none; 34 | } 35 | 36 | .title a:hover, 37 | .title a:focus, 38 | .title a:active { 39 | text-decoration: underline; 40 | } 41 | 42 | .title { 43 | margin: 0; 44 | line-height: 1.15; 45 | font-size: 4rem; 46 | } 47 | 48 | .title, 49 | .description { 50 | text-align: center; 51 | } 52 | 53 | .description { 54 | margin: 4rem 0; 55 | line-height: 1.5; 56 | font-size: 1.5rem; 57 | } 58 | 59 | .code { 60 | background: #fafafa; 61 | border-radius: 5px; 62 | padding: 0.75rem; 63 | font-size: 1.1rem; 64 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, 65 | Bitstream Vera Sans Mono, Courier New, monospace; 66 | } 67 | 68 | .grid { 69 | display: flex; 70 | align-items: center; 71 | justify-content: center; 72 | flex-wrap: wrap; 73 | max-width: 800px; 74 | } 75 | 76 | .card { 77 | margin: 1rem; 78 | padding: 1.5rem; 79 | text-align: left; 80 | color: inherit; 81 | text-decoration: none; 82 | border: 1px solid #eaeaea; 83 | border-radius: 10px; 84 | transition: color 0.15s ease, border-color 0.15s ease; 85 | max-width: 300px; 86 | } 87 | 88 | .card:hover, 89 | .card:focus, 90 | .card:active { 91 | color: #0070f3; 92 | border-color: #0070f3; 93 | } 94 | 95 | .card h2 { 96 | margin: 0 0 1rem 0; 97 | font-size: 1.5rem; 98 | } 99 | 100 | .card p { 101 | margin: 0; 102 | font-size: 1.25rem; 103 | line-height: 1.5; 104 | } 105 | 106 | .logo { 107 | height: 1em; 108 | margin-left: 0.5rem; 109 | } 110 | 111 | @media (max-width: 600px) { 112 | .grid { 113 | width: 100%; 114 | flex-direction: column; 115 | } 116 | } 117 | 118 | @media (prefers-color-scheme: dark) { 119 | .card, 120 | .footer { 121 | border-color: #222; 122 | } 123 | .code { 124 | background: #111; 125 | } 126 | .logo img { 127 | filter: invert(1); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /CustomSearchPage/styles/Startup.module.css: -------------------------------------------------------------------------------- 1 | .root{ 2 | background-color: white; 3 | min-height: 100vh; 4 | } 5 | 6 | .header { 7 | min-height: 60rempx; 8 | display: flex; 9 | justify-content: center; 10 | padding: 10rem 0 0 0; 11 | } 12 | 13 | 14 | 15 | .banner { 16 | object-fit: contain; 17 | object-position: center bottom; 18 | } 19 | 20 | .ascii { 21 | font-family: monospace; 22 | white-space: pre; 23 | display: flex; 24 | justify-content: center; 25 | width: 50%; 26 | } 27 | 28 | .searchBox { 29 | display: flex; 30 | justify-content: center; 31 | padding: 3rem 0 0 0; 32 | } 33 | .searchBar { 34 | border-radius: 24px; 35 | width: auto; 36 | max-width: 584px; 37 | border: 1px solid #5f6368; 38 | box-shadow: none; 39 | z-index: 3; 40 | margin: 0 auto; 41 | min-width: 40rem; 42 | min-height: 2rem; 43 | border-radius: 30px; 44 | background-color: #fff; 45 | color: #000; 46 | font-size: 30px; 47 | text-align: center; 48 | 49 | } 50 | 51 | .searchBar::placeholder { 52 | text-align: center; 53 | } 54 | 55 | 56 | .info { 57 | display: flex; 58 | justify-content: center; 59 | color: black; 60 | padding-inline-start: 0; 61 | list-style: none; 62 | list-style-position: outside; 63 | gap: 3rem; 64 | padding: 1.5rem; 65 | } 66 | 67 | 68 | @media (max-width: 600px) { 69 | .searchBar { 70 | min-width: 17rem; 71 | font-size: 15px; 72 | } 73 | .header { 74 | min-height: 60rempx; 75 | display: flex; 76 | justify-content: center; 77 | padding: 15rem 0 0 0; 78 | } 79 | .ascii { 80 | font-family: monospace; 81 | white-space: pre; 82 | display: flex; 83 | justify-content: center; 84 | width: 75%; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /CustomSearchPage/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | } 8 | 9 | a { 10 | color: inherit; 11 | text-decoration: none; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | 18 | @media (prefers-color-scheme: dark) { 19 | html { 20 | color-scheme: dark; 21 | } 22 | body { 23 | color: white; 24 | background: black; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CustomSearchPage/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NodeJS-Projects 2 | # hacktoberfest 3 | 4 | ## Contributing 5 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 6 | 7 | Please make sure to update tests as appropriate. 8 | 9 | ## License 10 | [MIT](https://choosealicense.com/licenses/mit/) 11 | 12 | hacktoberfest 2022 13 | hacktoberfest-indonesia 14 | GLOBAL CONTRIBUTION 15 | -------------------------------------------------------------------------------- /Travelling_Salesman.js: -------------------------------------------------------------------------------- 1 | // A salesman has a number of cities to visit. They want to calculate the total number of possible paths they could take, visiting each city once before returning home. Return the total number of possible paths a salesman can travel, given n cities. 2 | 3 | // this uses a factorial to solve it. 4 | 5 | function paths(n) { 6 | if (n < 0) return; 7 | if (n === 0) return 1; 8 | return n * paths(n - 1); 9 | } 10 | 11 | console.log(paths(4)) // 24 12 | console.log(paths(1)) // 1 13 | console.log(paths(9)) // 362880 14 | -------------------------------------------------------------------------------- /basic-challange/PaswordPattern.js: -------------------------------------------------------------------------------- 1 | const pattern = [ 2 | [2, 4, 5], 3 | [1, 3, 4, 5, 6], 4 | [2, 4, 5, 6], 5 | [1, 2, 5, 7, 8], 6 | [1, 2, 3, 4, 6, 7, 8, 9], 7 | [2, 3, 5, 8, 9], 8 | [4, 5, 8], 9 | [4, 5, 6, 7, 9], 10 | [5, 6, 8] 11 | ] 12 | 13 | const validate = (num) => { 14 | if (num.length > 7) { 15 | return false 16 | } 17 | 18 | if (num.length < 5) { 19 | return false 20 | } 21 | 22 | return true 23 | } 24 | 25 | const comparePattern = (a, b) => { 26 | let state = false 27 | if (pattern[a-1].includes(parseInt(b))) { 28 | state = true 29 | }else{ 30 | state = false 31 | } 32 | return state 33 | } 34 | 35 | const solution = (input) => { 36 | 37 | console.log("Input : ", input) 38 | let state = false 39 | 40 | if (validate(input)) { 41 | let split = input.split("") 42 | let t = 1 43 | 44 | for (let i = 0; i < split.length; i++) { 45 | if (split.length > t) { 46 | state = comparePattern(split[i], split[t]) 47 | t++ 48 | } 49 | } 50 | } 51 | 52 | return state ? "#YA" : "#TIDAK" 53 | } 54 | 55 | console.log(solution("12321")) 56 | console.log(solution("23654789")) 57 | console.log(solution("512369")) -------------------------------------------------------------------------------- /basic-challange/ShuffleArray.ts: -------------------------------------------------------------------------------- 1 | export function shuffleArray(array: Array): Array { 2 | let currentIndex = array.length, 3 | randomIndex; 4 | // While there remain elements to shuffle... 5 | while (0 !== currentIndex) { 6 | // Pick a remaining element... 7 | randomIndex = Math.floor(Math.random() * currentIndex); 8 | currentIndex--; 9 | // And swap it with the current element. 10 | [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; 11 | } 12 | return array; 13 | } 14 | 15 | // Consume utility 16 | interface People { 17 | name: string; 18 | gender: "M" | "F"; 19 | } 20 | 21 | const peoples = [{name: "Pangeran", gender: "M"}, {name: "Raja", gender: "M"}, {name: "Ratu", gender: "F"}]; 22 | 23 | // The result will shuffle the array 24 | console.log(shuffleArray(peoples)) 25 | -------------------------------------------------------------------------------- /basic-challange/Triangle.js: -------------------------------------------------------------------------------- 1 | const triangle = (n) => { 2 | let x = [] 3 | let y = [] 4 | 5 | for(let j = n; j > 0; j--){ 6 | for(let i = 0; i < j; i++){ 7 | x.push('*') 8 | } 9 | console.log(x.join('')) 10 | x = [] 11 | } 12 | 13 | for(let j = 1; j < n; j++){ 14 | for(let i = -1; i < j; i++){ 15 | y.push('*') 16 | } 17 | console.log(y.join('')) 18 | y = [] 19 | } 20 | } 21 | 22 | triangle(10) -------------------------------------------------------------------------------- /basic-challange/bst.js: -------------------------------------------------------------------------------- 1 | // class node merupakan isi dari suatu node yang akan dibangun 2 | // parameter yang dimiliki suatu node antara lain: 3 | // ada value atau data, ada child kiri dan child kanan 4 | class Node { 5 | constructor(value,left=null,right=null) { 6 | this.value = value 7 | this.left = left 8 | this.right = right 9 | } 10 | } 11 | 12 | class BST { 13 | constructor() { 14 | this.root = null; 15 | } 16 | 17 | insert(data) { 18 | let newNode = new Node(data) 19 | 20 | this.root == null ? this.root = newNode : this.insertNode(this.root, newNode) 21 | } 22 | 23 | insertNode(node, newNode){ 24 | if(newNode.data < node.data) { 25 | if(node.left === null) { 26 | node.left = newNode 27 | } else { 28 | this.insertNode(node.left, newNode) 29 | } 30 | } else { 31 | if(node.right === null) { 32 | node.right = newNode 33 | } else { 34 | this.insertNode(node.right, newNode) 35 | } 36 | } 37 | } 38 | } 39 | 40 | // rereference 41 | // https://www.geeksforgeeks.org/implementation-binary-search-tree-javascript/ -------------------------------------------------------------------------------- /basic-challange/complementaryDna.js: -------------------------------------------------------------------------------- 1 | // Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms. 2 | 3 | // If you want to know more: http://en.wikipedia.org/wiki/DNA 4 | 5 | // In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". Your function receives one side of the DNA (string, except for Haskell); you need to return the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell). 6 | 7 | const convert = (dna) => { 8 | let newArr = [] 9 | let tmp = dna.split('').map(e => { 10 | if(e == 'A') { 11 | newArr.push('T') 12 | } 13 | if(e == 'T') { 14 | newArr.push('A') 15 | } 16 | if(e == 'C') { 17 | newArr.push('G') 18 | } 19 | if(e == 'G') { 20 | newArr.push('C') 21 | } 22 | }) 23 | 24 | return newArr.join('') 25 | } 26 | let str = 'AAAC' 27 | let str = 'ATTGC' 28 | let str = 'GTAT' 29 | 30 | console.log(convert(str)) -------------------------------------------------------------------------------- /basic-challange/convertToBinary.js: -------------------------------------------------------------------------------- 1 | // Given a non-negative integer n, 2 | // write a function to_binary/ToBinary which returns that number in a binary format. 3 | 4 | const to_binary = (n) => { 5 | // easiest way convert to binary 6 | // return +n.toString(2) 7 | let bin = "" 8 | if(n < 0) return 'Must positive integer n' 9 | if(n === 1) return 1 10 | while (n > 0) { 11 | if( n % 2 == 1) { 12 | bin = "1" + bin 13 | } else { 14 | bin = "0" + bin 15 | } 16 | n = Math.floor(n / 2) 17 | } 18 | return bin 19 | } 20 | 21 | let dec = 10 22 | console.log(to_binary(dec)) 23 | 24 | // step by step 25 | // 1. jika n == 1 maka akan mengembalikan nilai tersebut 26 | // 2. jika n angka negatif maka akan dikembalikan string "harus bernilai integer positif" 27 | // 3. perulangan secara terus menerus selagi n lebih dari 0 28 | // 4. jika nilai n di modulo 2 == 1 maka akan memasukkan binary bernilai 1 pada varible bin 29 | // 5. jika !== 1 maka akan memasukkan nilai berupa 0 ke variable bin 30 | // 6. nilai n akan dibagi 2 dan dibulatkan ke nilai integer floor agar -------------------------------------------------------------------------------- /basic-challange/createaeslaknat.js: -------------------------------------------------------------------------------- 1 | var message = document.getElementById('msg').value; 2 | var key= '123456'; 3 | var iv = '1234567891011' 4 | 5 | function enkrip(){ 6 | 7 | var encrypted = CryptoJS.AES.encrypt(message, key, { iv: iv, mode: CryptoJS.mode.CBC, }); 8 | // var encrypted = CryptoJS.AES.encrypt(message, key); 9 | alert(encrypted.toString()); 10 | console.log(encrypted.toString()); 11 | console.log(encrypted); 12 | } 13 | 14 | function dekrip(){ 15 | var decrypted = CryptoJS.AES.decrypt(message, key, { iv: iv, mode: CryptoJS.mode.CBC, }); 16 | alert(decrypted.toString(CryptoJS.enc.Utf8)) 17 | console.log(decrypted.toString(CryptoJS.enc.Utf8)); 18 | } 19 | 20 | const password = 'secure secret key' 21 | 22 | const encrypt = (content, password) => CryptoJS.AES.encrypt(JSON.stringify({ content }), password).toString() 23 | const decrypt = (crypted, password) => JSON.parse(CryptoJS.AES.decrypt(crypted, password).toString(CryptoJS.enc.Utf8)).content 24 | 25 | // Encrypt 26 | const encryptedString = encrypt('This is a string', password) 27 | const encryptedObject = encrypt({ test: 'This is an object' }, password) 28 | console.log(encryptedString) 29 | console.log(encryptedObject) 30 | 31 | // Decrypt 32 | const decryptedString = decrypt(encryptedString, password) 33 | const decryptedObject = decrypt(encryptedObject, password) 34 | console.log(decryptedString) 35 | console.log(decryptedObject) 36 | -------------------------------------------------------------------------------- /basic-challange/deepSum.js: -------------------------------------------------------------------------------- 1 | function deepSum(arr) { 2 | let result = 0; 3 | arr.forEach((element) => { 4 | if (typeof element == "object") { 5 | result += deepSum(element); 6 | } else { 7 | result += element; 8 | } 9 | }); 10 | return result; 11 | } 12 | 13 | console.log( 14 | deepSum([ 15 | [ 16 | [4, 5, 6], 17 | [9, 1, 2, 10], 18 | [9, 4, 3], 19 | ], 20 | [ 21 | [4, 14, 31], 22 | [9, 10, 18, 12, 20], 23 | [1, 4, 90], 24 | ], 25 | [ 26 | [2, 5, 10], 27 | [3, 4, 5], 28 | [2, 4, 5, 10], 29 | ], 30 | ]) 31 | ); // 316 32 | 33 | console.log( 34 | deepSum([ 35 | [[20, 10], [15], [1, 1]], 36 | [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [2], [9, 11]], 37 | [[3, 5, 1], [1, 5, 3], [1]], 38 | [[2]], 39 | ]) 40 | ); // 156 41 | 42 | console.log(deepSum([])); // No number 43 | 44 | console.log( 45 | deepSum([ 46 | [[20, 10], [15], [1, 1]], 47 | [[1, 2, 3, 9, 10, 11], [2], [9, 11]], 48 | [[2]], 49 | ]) 50 | ); 51 | -------------------------------------------------------------------------------- /basic-challange/flippingMatrix.js: -------------------------------------------------------------------------------- 1 | function flippingMatrix(array) { 2 | let temp = { 3 | sum: null, 4 | index: null, 5 | }; 6 | 7 | array.forEach((element, index) => { 8 | let count = 0; 9 | 10 | element.forEach((element) => { 11 | count += element; 12 | }); 13 | 14 | if (temp.sum == null || temp.sum < count) { 15 | (temp.sum = count), (temp.index = index); 16 | } 17 | }); 18 | 19 | array.forEach((element, index) => { 20 | if (index === temp.index) { 21 | element.reverse(); 22 | } 23 | }); 24 | return array; 25 | } 26 | 27 | console.log( 28 | flippingMatrix([ 29 | [1, 2], 30 | [3, 4], 31 | ]) 32 | ); 33 | 34 | console.log( 35 | flippingMatrix([ 36 | [3, 0, 9], 37 | [10, 7, 3], 38 | [9, 4, 1], 39 | ]) 40 | ); 41 | -------------------------------------------------------------------------------- /basic-challange/mostFrequentLargestNumbers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implementasikan function sorting dan getTotal untuk mendapatkan angka yang paling besar dan mengetahui 3 | * berapa kali angka tersebut muncul di dalam arrNumber. 4 | * Dilarang mengubah mengubah 2 lines di dalam function mostFrequentLargestNumbers yaitu lines: 5 | * let listSort = sorting(arrNumber) 6 | * let countHighest = getTotal(listSort) 7 | */ 8 | function sorting(arrNumber) { 9 | return arrNumber.sort((a, b) => b - a); 10 | } 11 | 12 | function getTotal(arrNumber) { 13 | if (arrNumber.length === 0) { 14 | return ""; 15 | } 16 | 17 | let count = 0; 18 | let largestNumber = arrNumber[0]; 19 | 20 | arrNumber.forEach((element) => { 21 | if (element === largestNumber) { 22 | count += 1; 23 | } 24 | }); 25 | 26 | return `angka paling besar adalah ${largestNumber} dan jumlah kemunculan sebanyak ${count} kali`; 27 | } 28 | 29 | function mostFrequentLargestNumbers(arrNumber) { 30 | let listSort = sorting(arrNumber); 31 | let countHighest = getTotal(listSort); 32 | return countHighest; 33 | } 34 | 35 | console.log(mostFrequentLargestNumbers([2, 8, 4, 6, 8, 5, 8, 4])); 36 | //'angka paling besar adalah 8 dan jumlah kemunculan sebanyak 3 kali' 37 | 38 | console.log( 39 | mostFrequentLargestNumbers([122, 122, 130, 100, 135, 100, 135, 150]) 40 | ); 41 | //'angka paling besar adalah 150 dan jumlah kemunculan sebanyak 1 kali' 42 | 43 | console.log(mostFrequentLargestNumbers([1, 1, 1, 1])); 44 | //'angka paling besar adalah 1 dan jumlah kemunculan sebanyak 4 kali' 45 | 46 | console.log(mostFrequentLargestNumbers([])); 47 | //'' 48 | -------------------------------------------------------------------------------- /blabla.js: -------------------------------------------------------------------------------- 1 | const pattern = [ 2 | [2, 4, 5], 3 | [1, 3, 4, 5, 6], 4 | [2, 4, 5, 6], 5 | [1, 2, 5, 7, 8], 6 | [1, 2, 3, 4, 6, 7, 8, 9], 7 | [2, 3, 5, 8, 9], 8 | [4, 5, 8], 9 | [4, 5, 6, 7, 9], 10 | [5, 6, 8] 11 | ] 12 | 13 | const validate = (num) => { 14 | if (num.length > 7) { 15 | return false 16 | } 17 | 18 | if (num.length < 5) { 19 | return false 20 | } 21 | 22 | return true 23 | } 24 | 25 | const comparePattern = (a, b) => { 26 | let state = false 27 | if (pattern[a-1].includes(parseInt(b))) { 28 | state = true 29 | }else{ 30 | state = false 31 | } 32 | return state 33 | } 34 | 35 | const solution = (input) => { 36 | 37 | console.log("Input : ", input) 38 | let state = false 39 | 40 | if (validate(input)) { 41 | let split = input.split("") 42 | let t = 1 43 | 44 | for (let i = 0; i < split.length; i++) { 45 | if (split.length > t) { 46 | state = comparePattern(split[i], split[t]) 47 | t++ 48 | } 49 | } 50 | } 51 | 52 | return state ? "#YA" : "#TIDAK" 53 | } 54 | 55 | console.log(solution("12321")) 56 | console.log(solution("23654789")) 57 | console.log(solution("512369")) 58 | -------------------------------------------------------------------------------- /bookshelf-api/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "commonjs": true, 4 | "es2021": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "airbnb-base" 9 | ], 10 | "parserOptions": { 11 | "ecmaVersion": 12 12 | }, 13 | "rules": { 14 | "no-console": "off" 15 | } 16 | } -------------------------------------------------------------------------------- /bookshelf-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bookshelf-api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "nodemon ./src/server.js", 8 | "lint": "eslint ./" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "eslint": "^7.29.0", 15 | "eslint-config-airbnb-base": "^14.2.1", 16 | "eslint-plugin-import": "^2.23.4", 17 | "nodemon": "^2.0.7" 18 | }, 19 | "dependencies": { 20 | "@hapi/hapi": "^20.1.4", 21 | "nanoid": "^3.1.23" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bookshelf-api/src/books.js: -------------------------------------------------------------------------------- 1 | const books = []; 2 | 3 | module.exports = books; -------------------------------------------------------------------------------- /bookshelf-api/src/handler.js: -------------------------------------------------------------------------------- 1 | 2 | const { nanoid } = require('nanoid'); 3 | const books = require('./books'); 4 | 5 | const addBookHandler = (request, h) => { 6 | const { name, year, author, summary, publisher, pageCount, readPage, reading } = request.payload; 7 | 8 | if ( name === undefined ) { 9 | const response = h.response({ 10 | status: 'fail', 11 | message: 'Gagal menambahkan buku. Mohon isi nama buku', 12 | }); 13 | response.code(400); 14 | return response; 15 | } 16 | 17 | if (readPage > pageCount ) { 18 | const response = h.response({ 19 | status: 'fail', 20 | message: 'Gagal menambahkan buku. readPage tidak boleh lebih besar dari pageCount', 21 | }); 22 | response.code(400); 23 | return response; 24 | } 25 | 26 | const id = nanoid(16); 27 | 28 | const insertedAt = new Date().toISOString(); 29 | const updatedAt = insertedAt; 30 | 31 | const finished = (pageCount === readPage) ? true : false; 32 | 33 | const newBook = { 34 | id, name, year, author, summary, publisher, pageCount, readPage, finished, reading, insertedAt, updatedAt 35 | }; 36 | 37 | books.push(newBook); 38 | 39 | const isSuccess = books.filter((book) => book.id === id).length > 0; 40 | 41 | if (isSuccess) { 42 | const response = h.response({ 43 | status: 'success', 44 | message: 'Buku berhasil ditambahkan', 45 | data: { 46 | bookId: id, 47 | }, 48 | }); 49 | response.code(201); 50 | return response; 51 | } 52 | 53 | const response = h.response({ 54 | status: 'fail', 55 | message: 'Catatan gagal ditambahkan', 56 | }); 57 | response.code(500); 58 | return response; 59 | }; 60 | 61 | const getAllBooksHandler = (request, h) => { 62 | const { name, reading, finished } = request.query; 63 | let listBooks = books; 64 | 65 | if (name !== undefined) { 66 | listBooks = listBooks.filter((book) => 67 | book.name.toLowerCase().includes(name.toLowerCase()) 68 | ); 69 | } 70 | 71 | if (reading !== undefined) { 72 | listBooks = listBooks.filter((book) => book.reading == reading); 73 | } 74 | 75 | if (finished !== undefined) { 76 | listBooks = listBooks.filter( 77 | (book) => book.finished == finished 78 | ); 79 | } 80 | 81 | 82 | 83 | listBooks = listBooks.map((book) => ({ 84 | id: book.id, 85 | name: book.name, 86 | publisher: book.publisher, 87 | })); 88 | 89 | const response = h.response({ 90 | status: "success", 91 | data: { 92 | books: listBooks, 93 | }, 94 | }); 95 | 96 | response.code(200); 97 | return response; 98 | }; 99 | 100 | 101 | const getBookByIdHandler = (request, h) => { 102 | const { bookId } = request.params; 103 | 104 | const book = books.filter((book) => book.id === bookId)[0]; 105 | 106 | if (book !== undefined) { 107 | return { 108 | status: 'success', 109 | data: { 110 | book, 111 | }, 112 | }; 113 | } 114 | const response = h.response({ 115 | status: 'fail', 116 | message: 'Buku tidak ditemukan', 117 | }); 118 | response.code(404); 119 | return response; 120 | }; 121 | 122 | const editBookByIdHandler = (request, h) => { 123 | const { bookId } = request.params; 124 | 125 | const { name, year, author, summary, publisher, pageCount, readPage, reading } = request.payload; 126 | const updatedAt = new Date().toISOString(); 127 | 128 | if ( name === undefined ) { 129 | const response = h.response({ 130 | status: 'fail', 131 | message: 'Gagal memperbarui buku. Mohon isi nama buku', 132 | }); 133 | response.code(400); 134 | return response; 135 | } 136 | 137 | if (readPage > pageCount ) { 138 | const response = h.response({ 139 | status: 'fail', 140 | message: 'Gagal memperbarui buku. readPage tidak boleh lebih besar dari pageCount', 141 | }); 142 | response.code(400); 143 | return response; 144 | } 145 | 146 | const index = books.findIndex((book) => book.id === bookId); 147 | 148 | 149 | if (index !== -1) { 150 | books[index] = { 151 | ...books[index], 152 | name, 153 | year, 154 | author, 155 | summary, 156 | publisher, 157 | pageCount, 158 | readPage, 159 | reading, 160 | }; 161 | const response = h.response({ 162 | status: 'success', 163 | message: 'Buku berhasil diperbarui', 164 | }); 165 | response.code(200); 166 | return response; 167 | } 168 | const response = h.response({ 169 | status: 'fail', 170 | message: 'Gagal memperbarui buku. Id tidak ditemukan', 171 | }); 172 | response.code(404); 173 | return response; 174 | }; 175 | 176 | const deleteBookByIdHandler = (request, h) => { 177 | const { bookId } = request.params; 178 | 179 | const index = books.findIndex((book) => book.id === bookId); 180 | 181 | if (index !== -1) { 182 | books.splice(index, 1); 183 | const response = h.response({ 184 | status: 'success', 185 | message: 'Buku berhasil dihapus', 186 | }); 187 | response.code(200); 188 | return response; 189 | } 190 | 191 | const response = h.response({ 192 | status: 'fail', 193 | message: 'Buku gagal dihapus. Id tidak ditemukan', 194 | }); 195 | response.code(404); 196 | return response; 197 | }; 198 | 199 | module.exports = { addBookHandler, getAllBooksHandler, getBookByIdHandler, editBookByIdHandler, deleteBookByIdHandler}; 200 | 201 | /* 202 | { 203 | "name": "IZ*ONE HISTORY", 204 | "year": 2021, 205 | "author": "CJ ENT", 206 | "summary": "IZONE", 207 | "publisher": "CJ ENT", 208 | "pageCount": "100", 209 | "readPage": "10", 210 | "reading": true 211 | } 212 | */ -------------------------------------------------------------------------------- /bookshelf-api/src/routes.js: -------------------------------------------------------------------------------- 1 | const { addBookHandler, getAllBooksHandler, getBookByIdHandler, editBookByIdHandler, deleteBookByIdHandler } = require('./handler'); 2 | 3 | const routes = [ 4 | { 5 | method: 'POST', 6 | path: '/books', 7 | handler: addBookHandler, 8 | }, 9 | { 10 | method: 'GET', 11 | path: '/books', 12 | handler: getAllBooksHandler, 13 | }, 14 | { 15 | method: 'GET', 16 | path: '/books/{bookId}', 17 | handler: getBookByIdHandler, 18 | }, 19 | { 20 | method: 'PUT', 21 | path: '/books/{bookId}', 22 | handler: editBookByIdHandler, 23 | }, 24 | { 25 | method: 'DELETE', 26 | path: '/books/{bookId}', 27 | handler: deleteBookByIdHandler, 28 | }, 29 | ]; 30 | 31 | module.exports = routes; -------------------------------------------------------------------------------- /bookshelf-api/src/server.js: -------------------------------------------------------------------------------- 1 | const Hapi = require('@hapi/hapi'); 2 | const routes = require('./routes'); 3 | 4 | const init = async () => { 5 | const server = Hapi.server({ 6 | port: 5000, 7 | host: 'localhost', 8 | routes: { 9 | cors: { 10 | origin: ['*'], 11 | }, 12 | }, 13 | }); 14 | 15 | server.route(routes); 16 | 17 | await server.start(); 18 | console.log(`Server berjalan pada ${server.info.uri}`); 19 | }; 20 | 21 | 22 | init(); -------------------------------------------------------------------------------- /calculate_circle.js: -------------------------------------------------------------------------------- 1 | function circle_area(radius) { 2 | return Math.PI * Math.pow(radius, 2); 3 | } 4 | 5 | function circle_perimeter(radius) { 6 | return 2 * Math.PI * radius; 7 | } 8 | 9 | module.exports = { 10 | circle_area, 11 | circle_perimeter, 12 | } -------------------------------------------------------------------------------- /colorize-text.js: -------------------------------------------------------------------------------- 1 | const colorize = (...args) => ({ 2 | black: `\x1b[30m${args.join(' ')}`, 3 | red: `\x1b[31m${args.join(' ')}`, 4 | green: `\x1b[32m${args.join(' ')}`, 5 | yellow: `\x1b[33m${args.join(' ')}`, 6 | blue: `\x1b[34m${args.join(' ')}`, 7 | magenta: `\x1b[35m${args.join(' ')}`, 8 | cyan: `\x1b[36m${args.join(' ')}`, 9 | white: `\x1b[37m${args.join(' ')}`, 10 | bgBlack: `\x1b[40m${args.join(' ')}\x1b[0m`, 11 | bgRed: `\x1b[41m${args.join(' ')}\x1b[0m`, 12 | bgGreen: `\x1b[42m${args.join(' ')}\x1b[0m`, 13 | bgYellow: `\x1b[43m${args.join(' ')}\x1b[0m`, 14 | bgBlue: `\x1b[44m${args.join(' ')}\x1b[0m`, 15 | bgMagenta: `\x1b[45m${args.join(' ')}\x1b[0m`, 16 | bgCyan: `\x1b[46m${args.join(' ')}\x1b[0m`, 17 | bgWhite: `\x1b[47m${args.join(' ')}\x1b[0m` 18 | }); 19 | 20 | // console.log(colorize('foo').red); // 'foo' (red letters) 21 | // console.log(colorize('foo', 'bar').bgBlue); // 'foo bar' (blue background) 22 | // console.log(colorize(colorize('foo').yellow, colorize('foo').green).bgWhite); 23 | -------------------------------------------------------------------------------- /express-vercel/.github/workflows/.gitignore: -------------------------------------------------------------------------------- 1 | .vercel 2 | -------------------------------------------------------------------------------- /express-vercel/.github/workflows/github-ci-vercel-preview.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Actions Vercel Production Deployment 2 | env: 3 | VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} 4 | VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} 5 | on: 6 | push: 7 | branches-ignore: 8 | - main 9 | jobs: 10 | Deploy-Preview: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Install Vercel CLI 15 | run: npm install --global vercel@latest 16 | - name: Pull Vercel Environment Information 17 | run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} 18 | - name: Build Project Artifacts 19 | run: vercel build --token=${{ secrets.VERCEL_TOKEN }} 20 | - name: Deploy Project Artifacts to Vercel 21 | run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} 22 | -------------------------------------------------------------------------------- /express-vercel/.github/workflows/github-ci-vercel-production.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Actions Vercel Preview Deployment 2 | env: 3 | VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} 4 | VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} 5 | on: 6 | push: 7 | branches-ignore: 8 | - main 9 | jobs: 10 | Deploy-Preview: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Install Vercel CLI 15 | run: npm install --global vercel@latest 16 | - name: Pull Vercel Environment Information 17 | run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} 18 | - name: Build Project Artifacts 19 | run: vercel build --token=${{ secrets.VERCEL_TOKEN }} 20 | - name: Deploy Project Artifacts to Vercel 21 | run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} 22 | -------------------------------------------------------------------------------- /express-vercel/.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [14.x, 16.x, 18.x] 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 21 | 22 | steps: 23 | - uses: actions/checkout@v3 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v3 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | cache: 'npm' 29 | - run: npm ci 30 | - run: npm run build --if-present 31 | - run: npm test 32 | -------------------------------------------------------------------------------- /express-vercel/.gitignore: -------------------------------------------------------------------------------- 1 | logs 2 | *.log 3 | npm-debug.log* 4 | yarn-debug.log* 5 | yarn-error.log* 6 | lerna-debug.log* 7 | 8 | node_modules/ 9 | jspm_packages/ 10 | -------------------------------------------------------------------------------- /express-vercel/controllers/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | index: async (req, res, next) => { 3 | try { 4 | return res.status(200).json({ 5 | status: true, 6 | message: "Get Data Successfully" 7 | }); 8 | } catch (error) { 9 | next(error) 10 | } 11 | }, 12 | 13 | delete: async (req, res, next) => { 14 | try { 15 | return res.status(200).json({ 16 | status: true, 17 | message: "Deleted User Data Successfully" 18 | }); 19 | } catch (error) { 20 | next(error) 21 | } 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /express-vercel/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const product = require('./routes'); 4 | 5 | app.use(express.json({extended: false})); 6 | 7 | // app.use('/api/product', product); 8 | app.use('/', product) 9 | 10 | const PORT = process.env.PORT || 8000; 11 | app.listen(PORT, () => console.log(`Server is running in port ${PORT}`)); 12 | 13 | 14 | -------------------------------------------------------------------------------- /express-vercel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-vercel", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "repository": "git@gitlab.com:gricowijaya/express-vercel.git", 6 | "author": "Gede Rico Wijaya ", 7 | "license": "MIT", 8 | "scripts": { 9 | "start": "node index.js", 10 | "dev": "nodemon index.js", 11 | "test": "jest" 12 | }, 13 | "dependencies": { 14 | "express": "^4.18.2" 15 | }, 16 | "devDependencies": { 17 | "jest": "^29.2.1", 18 | "nodemon": "^2.0.20", 19 | "supertest": "^6.3.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /express-vercel/readme.md: -------------------------------------------------------------------------------- 1 | EXPRESS APP with CI/CD 2 | 3 | Deployed using vercel 4 | -------------------------------------------------------------------------------- /express-vercel/routes/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const router = express.Router(); 3 | const controller = require('../controllers/index') 4 | 5 | router.get('/', controller.index); 6 | 7 | router.get('/delete-user', controller.delete); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /express-vercel/tests/test.spec.js: -------------------------------------------------------------------------------- 1 | const product = require('../controllers/index.js'); 2 | const mockRequest = (body={}) => ({ body }) 3 | const mockResponse = () => { 4 | const res = {} 5 | res.json = jest.fn().mockReturnValue(res); 6 | res.status = jest.fn().mockReturnValue(res); 7 | return res; 8 | } 9 | 10 | // endpoint GET/ 11 | describe('product.index.function', () => { 12 | // case if success 13 | test('res.json called with {status: true, message: "Get Data Successfully"}', done => { 14 | const req = mockRequest(); 15 | const res = mockResponse(); 16 | product.index(req, res); 17 | expect(res.status).toBeCalledWith(200); // expected status 18 | expect(res.json).toBeCalledWith({ 19 | status: true, 20 | message: "Get Data Successfully" 21 | }); 22 | done(); 23 | }); 24 | }); 25 | 26 | // // endpoint that delete the sum 27 | describe('product.delete.function', () => { 28 | // case if success 29 | test('res.json called with {status: true, message: "Deleted User Data Successfully"}', done => { 30 | const req = mockRequest(); 31 | const res = mockResponse(); 32 | product.delete(req, res); 33 | expect(res.status).toBeCalledWith(200); // expected status 34 | expect(res.json).toBeCalledWith({ 35 | status: true, 36 | message: "Deleted User Data Successfully" 37 | }); 38 | done(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /generate-uuid.js: -------------------------------------------------------------------------------- 1 | const crypto = require('crypto'); 2 | 3 | const UUIDGeneratorNode = () => 4 | ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => 5 | (c ^ (crypto.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16) 6 | ); 7 | -------------------------------------------------------------------------------- /google-play-scraper/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const gplay = require('google-play-scraper') 3 | const app = express() 4 | 5 | /* 6 | | ------------------------------------------------------ 7 | | e.g http://localhost:3000?id=com.alibaba.aliexpresshd 8 | | 9 | | return json 10 | | { 11 | | "title": "AliExpress", 12 | | "version": "8.55.1" 13 | | } 14 | | ------------------------------------------------------ 15 | */ 16 | https: app.get('/', async (req, res) => { 17 | const { id } = req.query 18 | if (!id) return res.status(400).send('No id provided') 19 | 20 | try { 21 | const { title, version } = await gplay.app({ appId: id }) 22 | 23 | res.send({ title, version }) 24 | } catch (err) { 25 | res.status(500).send(err.message) 26 | } 27 | }) 28 | 29 | app.listen(3000, () => console.log('Example app listening on port 3000!')) 30 | -------------------------------------------------------------------------------- /google-play-scraper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google-play-scraper-api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "aryarfani", 10 | "license": "ISC", 11 | "dependencies": { 12 | "axios": "^0.27.2", 13 | "express": "^4.18.1", 14 | "google-play-scraper": "git+https://github.com/facundoolano/google-play-scraper" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hello-world.js: -------------------------------------------------------------------------------- 1 | http.createServer(function (request, response) { 2 | // Send the HTTP header 3 | // HTTP Status: 200 : OK 4 | // Content Type: text/plain 5 | response.writeHead(200, {'Content-Type': 'text/plain'}); 6 | 7 | // Send the response body as "Hello World" 8 | response.end('Hello World\n'); 9 | }).listen(8081); 10 | 11 | // Console will print the message 12 | console.log('Server running at http://127.0.0.1:8081/'); -------------------------------------------------------------------------------- /matrix.js: -------------------------------------------------------------------------------- 1 | const matcal = (matrix) => { 2 | let him = []; 3 | for (j = 0; j < matrix.length; j++) { 4 | awal = matrix[j][0]; 5 | for (i = 0; i < matrix[0].length - 1; i++) { 6 | let n = i + 1; 7 | awal = awal.map((res, i) => res + matrix[j][n][i]); 8 | } 9 | him.push(awal); 10 | } 11 | return him; 12 | }; 13 | 14 | const example = [ 15 | [ 16 | [1, 1, 1], 17 | [3, 4, 5], 18 | [6, 7, 8], 19 | ], 20 | [ 21 | [1 / 5, 1 / 4, 1 / 3], 22 | [1, 1, 1], 23 | [4, 5, 6], 24 | ], 25 | [ 26 | [1 / 8, 1 / 7, 1 / 6], 27 | [1 / 6, 1 / 5, 1 / 4], 28 | [1, 1, 1], 29 | ], 30 | ]; 31 | 32 | const result = matcal(example); 33 | console.log(result); 34 | -------------------------------------------------------------------------------- /phonenumberbyarray-farizz.js: -------------------------------------------------------------------------------- 1 | function createPhoneNumber(numbers) { 2 | var result = ""; 3 | numbers.forEach((data, index) => { 4 | if (index == 0) { 5 | result += `(${data}` 6 | } else if (index == 2) { 7 | result += `${data}) ` 8 | } else if (index == 5) { 9 | result += `${data}-` 10 | } else { 11 | result += data 12 | } 13 | }) 14 | return result 15 | } 16 | createPhoneNumber([1,2,3,4,5,6,7,8,9,0]) 17 | -------------------------------------------------------------------------------- /random_number.js: -------------------------------------------------------------------------------- 1 | if(!process.argv[2] || isNaN(parseInt(process.argv[2]))){ 2 | throw new Error('Invalid Argument'); 3 | } else { 4 | console.log(Math.floor(Math.random() * Math.pow(process.argv[2], parseInt(1)))); 5 | } 6 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | // server.js 2 | var fs = require('fs'); 3 | var app = require('./app'); 4 | var httpPort = process.env.PORT || 8000; 5 | var httpsPort = process.env.PORT || 8100; 6 | var http = require('http'); 7 | // var https = require('https'); 8 | // var privateKey = fs.readFileSync('certificates/private.key', 'utf8'); 9 | // var certificate = fs.readFileSync('certificates/certificate.crt', 'utf8'); 10 | // var credentials = {key: privateKey, cert: certificate}; 11 | var httpServer = http.createServer(app); 12 | // var httpsServer = https.createServer(credentials, app); 13 | const winston = require('winston'); 14 | 15 | const logger = winston.createLogger({ 16 | transports: [ 17 | new winston.transports.File({ 18 | filename: './logs/error.log', 19 | level: 'error', 20 | format: winston.format.json() 21 | }), 22 | new winston.transports.File({ 23 | filename: './logs/success.log', 24 | level: 'info', 25 | format: winston.format.json() 26 | }), 27 | new winston.transports.Http({ 28 | filename: './logs/http.log', 29 | level: 'error', 30 | format: winston.format.json() 31 | }), 32 | new winston.transports.Console({ 33 | filename: './logs/console.log', 34 | level: 'error', 35 | format: winston.format.json() 36 | }) 37 | ] 38 | }); 39 | 40 | // LOGGER IN PRODUCTION 41 | if (process.env.NODE_ENV !== 'production') { 42 | logger.add(new winston.transports.Console({ 43 | format: winston.format.simple(), 44 | })); 45 | } 46 | 47 | // Socket.io server 48 | const { Server } = require('socket.io'); 49 | const io = new Server(httpServer, { 50 | cors: { 51 | origin: ["*", "http://localhost", "http://localhost:8100"], 52 | methods: ["GET", "POST"], 53 | transports: ['websocket', 'polling'], 54 | credentials: true 55 | }, 56 | allowEIO3: true 57 | }); 58 | const socketEvents = require('../socket/events')(io); 59 | socketEvents; 60 | // Load exchange rates 61 | var money = require('../config/money'); 62 | money.getRates(); 63 | // Run script 64 | var runScript = require('./scripts/runScript'); 65 | runScript.run(); 66 | 67 | // Starting Server (HTTP) 68 | httpServer.listen(httpPort, function() { 69 | console.log('LoanApp API (HTTP) Development Server listening on port ' + httpPort); 70 | }); 71 | 72 | // // Starting Server (HTTPS) 73 | // httpsServer.listen(httpsPort, function() { 74 | // console.log('LoanApp API (HTTPS) Development Server listening on port ' + httpsPort); 75 | // }); 76 | 77 | // Default launch URL 78 | app.use('/', function(req, res) { 79 | res.status(200).send({ message: 'LoanApp API Development Server is Running' }); 80 | }); 81 | 82 | -------------------------------------------------------------------------------- /service-user/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FirmanKurniawan/NodeJS-Projects/f520cdd8e4e1163e3414ba5a6692b24ecad95462/service-user/.DS_Store -------------------------------------------------------------------------------- /service-user/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | .env -------------------------------------------------------------------------------- /service-user/app.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const express = require('express'); 3 | const path = require('path'); 4 | const cookieParser = require('cookie-parser'); 5 | const logger = require('morgan'); 6 | 7 | const indexRouter = require('./routes/index'); 8 | const usersRouter = require('./routes/users'); 9 | const refreshTokensRouter = require('./routes/refreshTokens'); 10 | 11 | const app = express(); 12 | 13 | app.use(logger('dev')); 14 | app.use(express.json()); 15 | app.use(express.urlencoded({ extended: false })); 16 | app.use(cookieParser()); 17 | app.use(express.static(path.join(__dirname, 'public'))); 18 | 19 | app.use('/', indexRouter); 20 | app.use('/users', usersRouter); 21 | app.use('/refresh-tokens', refreshTokensRouter); 22 | 23 | module.exports = app; 24 | -------------------------------------------------------------------------------- /service-user/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('service-user:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /service-user/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const { DB_USERNAME, DB_PASSWORD, DB_HOST, DB_NAME } = process.env; 3 | 4 | module.exports = { 5 | development: { 6 | username: DB_USERNAME, 7 | password: DB_PASSWORD, 8 | database: DB_NAME, 9 | host: DB_HOST, 10 | dialect: "mysql", 11 | }, 12 | test: { 13 | username: DB_USERNAME, 14 | password: DB_PASSWORD, 15 | database: DB_NAME, 16 | host: DB_HOST, 17 | dialect: "mysql", 18 | }, 19 | production: { 20 | username: DB_USERNAME, 21 | password: DB_PASSWORD, 22 | database: DB_NAME, 23 | host: DB_HOST, 24 | dialect: "mysql", 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /service-user/controllers/RefreshTokenController.js: -------------------------------------------------------------------------------- 1 | const { RefreshToken, User } = require("../models"); 2 | const Validator = require("fastest-validator"); 3 | const v = new Validator(); 4 | 5 | module.exports = { 6 | store: async (req, res) => { 7 | const { user_id, refresh_token } = req.body; 8 | 9 | const rules = { 10 | refresh_token: "string|empty:false", 11 | user_id: "number|empty:false", 12 | }; 13 | 14 | const validate = v.validate(req.body, rules); 15 | if (validate.length) { 16 | return res.status(422).json({ 17 | status: "error", 18 | message: validate, 19 | }); 20 | } 21 | 22 | const user = await User.findByPk(user_id); 23 | 24 | if (!user) { 25 | return res.status(404).json({ 26 | status: "error", 27 | message: "user not found", 28 | }); 29 | } 30 | 31 | const createdRefreshToken = await RefreshToken.create({ 32 | token: refresh_token, 33 | user_id, 34 | }); 35 | 36 | return res.json({ 37 | status: "success", 38 | message: "successfully create token", 39 | data: { 40 | id: createdRefreshToken.id, 41 | }, 42 | }); 43 | }, 44 | getToken: async (req, res) => { 45 | const { refresh_token } = req.query; 46 | const token = await RefreshToken.findOne({ 47 | where: { 48 | token: refresh_token, 49 | }, 50 | }); 51 | 52 | if (!token) { 53 | return res.status(404).json({ 54 | status: "error", 55 | message: "invalid token", 56 | }); 57 | } 58 | 59 | return res.json({ 60 | status: "success", 61 | token, 62 | }); 63 | }, 64 | }; 65 | -------------------------------------------------------------------------------- /service-user/controllers/UserController.js: -------------------------------------------------------------------------------- 1 | const { User, RefreshToken } = require("../models"); 2 | const bcrypt = require("bcrypt"); 3 | const validator = require("fastest-validator"); 4 | const v = new validator(); 5 | 6 | module.exports = { 7 | index: async (req, res) => { 8 | const userIds = req.query.user_ids || []; 9 | 10 | const sqlOptions = { 11 | attributes: ["id", "name", "email", "profession", "role", "avatar"], 12 | }; 13 | 14 | if (userIds.length) { 15 | sqlOptions.where = { 16 | id: userIds, 17 | }; 18 | } 19 | 20 | const users = await User.findAll(sqlOptions); 21 | 22 | return res.json({ 23 | status: "success", 24 | message: "get list user", 25 | data: users, 26 | }); 27 | }, 28 | show: async (req, res) => { 29 | const { id } = req.params; 30 | const user = await User.findByPk(id, { 31 | attributes: ["id", "name", "email", "role", "profession", "avatar"], 32 | }); 33 | if (!user) { 34 | return res.status(404).json({ 35 | status: "error", 36 | message: "user not found", 37 | }); 38 | } 39 | return res.json({ 40 | status: "success", 41 | message: "get user info", 42 | data: user, 43 | }); 44 | }, 45 | register: async (req, res) => { 46 | const rules = { 47 | name: "string|empty:false", 48 | email: "email|empty:false", 49 | password: "string|min:6", 50 | profession: "string|optional", 51 | }; 52 | 53 | const validate = v.validate(req.body, rules); 54 | if (validate.length) { 55 | return res.status(422).json({ 56 | status: "error", 57 | message: validate, 58 | }); 59 | } 60 | 61 | const user = await User.findOne({ 62 | where: { 63 | email: req.body.email, 64 | }, 65 | }); 66 | 67 | if (user) { 68 | return res.status(409).json({ 69 | status: "error", 70 | message: "email already exist", 71 | }); 72 | } 73 | 74 | const password = await bcrypt.hash(req.body.password, 10); 75 | 76 | const data = { 77 | password, 78 | email: req.body.email, 79 | name: req.body.name, 80 | profession: req.body.profession, 81 | role: "student", 82 | }; 83 | 84 | const createUser = await User.create(data); 85 | 86 | return res.status(201).json({ 87 | status: "success", 88 | message: "successfully register new user", 89 | data: { 90 | id: createUser.id, 91 | }, 92 | }); 93 | }, 94 | login: async (req, res) => { 95 | const rules = { 96 | email: "email|empty:false", 97 | password: "string|min:6", 98 | }; 99 | 100 | const validate = v.validate(req.body, rules); 101 | if (validate.length) { 102 | return res.status(422).json({ 103 | status: "error", 104 | message: validate, 105 | }); 106 | } 107 | 108 | const user = await User.findOne({ where: { email: req.body.email } }); 109 | 110 | if (!user) { 111 | return res.status(404).json({ 112 | status: "error", 113 | message: "user not found", 114 | }); 115 | } 116 | 117 | const isValidPassword = await bcrypt.compare( 118 | req.body.password, 119 | user.password 120 | ); 121 | 122 | if (!isValidPassword) { 123 | return res.status(404).json({ 124 | status: "error", 125 | message: "wrong password", 126 | }); 127 | } 128 | 129 | return res.json({ 130 | status: "success", 131 | message: "login success", 132 | data: { 133 | id: user.id, 134 | name: user.name, 135 | email: user.email, 136 | role: user.role, 137 | avatar: user.avatar, 138 | profession: user.profession, 139 | }, 140 | }); 141 | }, 142 | update: async (req, res) => { 143 | const rules = { 144 | name: "string|empty:false", 145 | email: "email|empty:false", 146 | password: "string|min:6", 147 | profession: "string|optional", 148 | avatar: "string|optional", 149 | }; 150 | 151 | const validate = v.validate(req.body, rules); 152 | if (validate.length) { 153 | return res.status(422).json({ 154 | status: "error", 155 | message: validate, 156 | }); 157 | } 158 | 159 | const { id } = req.params; 160 | 161 | const user = await User.findByPk(id); 162 | 163 | if (!user) { 164 | return res.status(404).json({ 165 | status: "error", 166 | message: "user not found", 167 | }); 168 | } 169 | 170 | const { email } = req.body; 171 | 172 | if (email) { 173 | const checkEmail = await User.findOne({ where: { email } }); 174 | if (checkEmail && email !== user.email) { 175 | return res.status(409).json({ 176 | status: "error", 177 | message: "email already exist", 178 | }); 179 | } 180 | } 181 | 182 | const password = await bcrypt.hash(req.body.password, 10); 183 | const { name, profession, avatar } = req.body; 184 | 185 | const updatedUser = await user.update({ 186 | email, 187 | password, 188 | name, 189 | profession, 190 | avatar, 191 | }); 192 | 193 | return res.json({ 194 | status: "success", 195 | message: "successfully update user profile", 196 | data: { 197 | id: updatedUser.id, 198 | name: updatedUser.name, 199 | email: updatedUser.email, 200 | profession: updatedUser.profession, 201 | avatar: updatedUser.avatar, 202 | }, 203 | }); 204 | }, 205 | logout: async (req, res) => { 206 | const { user_id } = req.body; 207 | 208 | const user = await User.findByPk(user_id); 209 | 210 | if (!user) { 211 | return res.status(404).json({ 212 | status: "error", 213 | message: "user not found", 214 | }); 215 | } 216 | 217 | await RefreshToken.destroy({ 218 | where: { user_id }, 219 | }); 220 | 221 | return res.json({ 222 | status: "success", 223 | message: "refresh token deleted successfully", 224 | }); 225 | }, 226 | }; 227 | -------------------------------------------------------------------------------- /service-user/env.example: -------------------------------------------------------------------------------- 1 | PORT=8081 2 | 3 | DB_HOST= 4 | DB_USERNAME= 5 | DB_PASSWORD= 6 | DB_NAME= -------------------------------------------------------------------------------- /service-user/migrations/20220124144247-create_users_table.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | async up(queryInterface, Sequelize) { 5 | await queryInterface.createTable("users", { 6 | id: { 7 | type: Sequelize.INTEGER, 8 | primaryKey: true, 9 | autoIncrement: true, 10 | allowNull: false, 11 | }, 12 | name: { 13 | type: Sequelize.STRING, 14 | allowNull: false, 15 | }, 16 | profession: { 17 | type: Sequelize.STRING, 18 | allowNull: true, 19 | }, 20 | avatar: { 21 | type: Sequelize.STRING, 22 | allowNull: true, 23 | }, 24 | role: { 25 | type: Sequelize.ENUM, 26 | values: ["admin", "student"], 27 | allowNull: false, 28 | }, 29 | email: { 30 | type: Sequelize.STRING, 31 | allowNull: false, 32 | }, 33 | password: { 34 | type: Sequelize.STRING, 35 | allowNull: false, 36 | }, 37 | created_at: { 38 | type: Sequelize.DATE, 39 | allowNull: false, 40 | }, 41 | updated_at: { 42 | type: Sequelize.DATE, 43 | allowNull: false, 44 | }, 45 | }); 46 | 47 | await queryInterface.addConstraint("users", { 48 | type: "unique", 49 | fields: ["email"], 50 | name: "custom_unique_constraint_email", 51 | }); 52 | }, 53 | 54 | async down(queryInterface, Sequelize) { 55 | await queryInterface.dropTable("users"); 56 | }, 57 | }; 58 | -------------------------------------------------------------------------------- /service-user/migrations/20220124144311-create_refresh_token_table.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | async up(queryInterface, Sequelize) { 5 | await queryInterface.createTable("refresh_tokens", { 6 | id: { 7 | type: Sequelize.INTEGER, 8 | primaryKey: true, 9 | autoIncrement: true, 10 | allowNull: false, 11 | }, 12 | token: { 13 | type: Sequelize.TEXT, 14 | allowNull: false, 15 | }, 16 | user_id: { 17 | type: Sequelize.INTEGER, 18 | allowNull: false, 19 | }, 20 | created_at: { 21 | type: Sequelize.DATE, 22 | allowNull: false, 23 | }, 24 | updated_at: { 25 | type: Sequelize.DATE, 26 | allowNull: false, 27 | }, 28 | }); 29 | 30 | await queryInterface.addConstraint("refresh_tokens", { 31 | type: "foreign key", 32 | fields: ["user_id"], 33 | name: "custom_fkey_constraint_user_id", 34 | references: { 35 | table: "users", 36 | field: "id", 37 | }, 38 | }); 39 | }, 40 | 41 | async down(queryInterface, Sequelize) { 42 | await queryInterface.dropTable("refresh_tokens"); 43 | }, 44 | }; 45 | -------------------------------------------------------------------------------- /service-user/models/RefreshToken.js: -------------------------------------------------------------------------------- 1 | module.exports = (Sequelize, DataTypes) => { 2 | const RefreshToken = Sequelize.define( 3 | "RefreshToken", 4 | { 5 | id: { 6 | type: DataTypes.INTEGER, 7 | primaryKey: true, 8 | autoIncrement: true, 9 | allowNull: false, 10 | }, 11 | token: { 12 | type: DataTypes.TEXT, 13 | allowNull: false, 14 | }, 15 | user_id: { 16 | type: DataTypes.INTEGER, 17 | allowNull: false, 18 | }, 19 | createdAt: { 20 | field: "created_at", 21 | type: DataTypes.DATE, 22 | allowNull: false, 23 | }, 24 | updatedAt: { 25 | field: "updated_at", 26 | type: DataTypes.DATE, 27 | allowNull: false, 28 | }, 29 | }, 30 | { 31 | tableName: "refresh_tokens", 32 | timestamp: true, 33 | } 34 | ); 35 | 36 | return RefreshToken; 37 | }; 38 | -------------------------------------------------------------------------------- /service-user/models/User.js: -------------------------------------------------------------------------------- 1 | module.exports = (Sequelize, DataTypes) => { 2 | const User = Sequelize.define( 3 | "User", 4 | { 5 | id: { 6 | type: DataTypes.INTEGER, 7 | primaryKey: true, 8 | autoIncrement: true, 9 | allowNull: false, 10 | }, 11 | name: { 12 | type: DataTypes.STRING, 13 | allowNull: false, 14 | }, 15 | profession: { 16 | type: DataTypes.STRING, 17 | allowNull: true, 18 | }, 19 | avatar: { 20 | type: DataTypes.STRING, 21 | allowNull: true, 22 | }, 23 | role: { 24 | type: DataTypes.ENUM, 25 | values: ["admin", "student"], 26 | allowNull: false, 27 | defaultValue: "student", 28 | }, 29 | email: { 30 | type: DataTypes.STRING, 31 | allowNull: false, 32 | unique: true, 33 | }, 34 | password: { 35 | type: DataTypes.STRING, 36 | allowNull: false, 37 | }, 38 | createdAt: { 39 | field: "created_at", 40 | type: DataTypes.DATE, 41 | allowNull: false, 42 | }, 43 | updatedAt: { 44 | field: "updated_at", 45 | type: DataTypes.DATE, 46 | allowNull: false, 47 | }, 48 | }, 49 | { 50 | tableName: "users", 51 | timestamp: true 52 | } 53 | ); 54 | 55 | return User; 56 | }; 57 | -------------------------------------------------------------------------------- /service-user/models/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const Sequelize = require('sequelize'); 6 | const basename = path.basename(__filename); 7 | const env = process.env.NODE_ENV || 'development'; 8 | const config = require(__dirname + '/../config/config.js')[env]; 9 | const db = {}; 10 | 11 | let sequelize; 12 | if (config.use_env_variable) { 13 | sequelize = new Sequelize(process.env[config.use_env_variable], config); 14 | } else { 15 | sequelize = new Sequelize(config.database, config.username, config.password, config); 16 | } 17 | 18 | fs 19 | .readdirSync(__dirname) 20 | .filter(file => { 21 | return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js'); 22 | }) 23 | .forEach(file => { 24 | const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes); 25 | db[model.name] = model; 26 | }); 27 | 28 | Object.keys(db).forEach(modelName => { 29 | if (db[modelName].associate) { 30 | db[modelName].associate(db); 31 | } 32 | }); 33 | 34 | db.sequelize = sequelize; 35 | db.Sequelize = Sequelize; 36 | 37 | module.exports = db; 38 | -------------------------------------------------------------------------------- /service-user/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "service-user", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "nodemon ./bin/www" 7 | }, 8 | "dependencies": { 9 | "bcrypt": "^5.0.1", 10 | "cookie-parser": "~1.4.4", 11 | "debug": "~2.6.9", 12 | "dotenv": "^14.2.0", 13 | "express": "~4.16.1", 14 | "fastest-validator": "^1.12.0", 15 | "morgan": "~1.9.1", 16 | "mysql2": "^2.3.3", 17 | "sequelize": "^6.14.0", 18 | "sequelize-cli": "^6.4.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /service-user/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Express 5 | 6 | 7 | 8 | 9 |

    Express

    10 |

    Welcome to Express

    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /service-user/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | -------------------------------------------------------------------------------- /service-user/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET home page. */ 5 | router.get('/', function(req, res, next) { 6 | res.render('index', { title: 'Express' }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /service-user/routes/refreshTokens.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | 4 | const { store, getToken } = require("../controllers/RefreshTokenController"); 5 | 6 | router.post("/", store); 7 | router.get("/", getToken); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /service-user/routes/users.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | 4 | const { 5 | register, 6 | login, 7 | update, 8 | show, 9 | index, 10 | logout, 11 | } = require("../controllers/UserController"); 12 | 13 | router.get("/", index); 14 | router.get("/:id", show); 15 | router.put("/:id", update); 16 | router.post("/register", register); 17 | router.post("/login", login); 18 | router.post("/logout", logout); 19 | 20 | module.exports = router; 21 | -------------------------------------------------------------------------------- /service-user/seeders/20220124150408-user_seeders.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const bcrypt = require("bcrypt"); 3 | 4 | module.exports = { 5 | async up(queryInterface, Sequelize) { 6 | await queryInterface.bulkInsert( 7 | "users", 8 | [ 9 | { 10 | name: "BrondoL", 11 | profession: "Admin web", 12 | role: "admin", 13 | email: "nabilunited2@gmail.com", 14 | password: await bcrypt.hash("rahasia", 10), 15 | created_at: new Date(), 16 | updated_at: new Date(), 17 | }, 18 | { 19 | name: "Wawik", 20 | profession: "Front End Developer", 21 | role: "student", 22 | email: "wawik@gmail.com", 23 | password: await bcrypt.hash("rahasia", 10), 24 | created_at: new Date(), 25 | updated_at: new Date(), 26 | }, 27 | ], 28 | {} 29 | ); 30 | }, 31 | 32 | async down(queryInterface, Sequelize) { 33 | await queryInterface.bulkDelete("users", null, {}); 34 | }, 35 | }; 36 | -------------------------------------------------------------------------------- /static-file-server.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const http = require('http'); 3 | 4 | http.createServer((req, res) => { 5 | fs.readFile(__dirname + req.url, (err, data) => { 6 | if (err) { 7 | res.writeHead(404, { 'Content-Type': 'text/html' }); 8 | res.end('404: File not found'); 9 | } else { 10 | res.writeHead(200, { 'Content-Type': 'text/html' }); 11 | res.end(data); 12 | } 13 | }); 14 | }).listen(8000); 15 | --------------------------------------------------------------------------------