├── BookImages └── Book images.pdf ├── Chapter03 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ └── tsconfig.json ├── Chapter04 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ └── index.hbs ├── Chapter06 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── public │ └── css │ │ └── app.css │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── index.hbs │ └── layouts │ └── app.hbs ├── Chapter07 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ └── layouts │ └── app.hbs ├── Chapter08 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ └── layouts │ └── app.hbs ├── Chapter09 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ └── layouts │ └── app.hbs ├── Chapter10 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ ├── layouts │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter12 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ ├── layouts │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter13 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ └── product.entity.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ ├── layouts │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter14 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ ├── layouts │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter15 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ └── submarine.png │ ├── src │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── index.hbs │ ├── layouts │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter16 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ └── admin.module.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter17 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter18 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ └── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter19 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ └── 72d058ba219a2148f248c580bc606a88 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter20 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ └── products.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter21 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ └── register.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter22 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ └── products.controller.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter23 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ ├── products.controller.ts │ └── validators │ │ ├── product.validator.ts │ │ └── user.validator.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter24 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ ├── products.controller.ts │ └── validators │ │ ├── product.validator.ts │ │ └── user.validator.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter25 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── cart │ │ ├── cart.controller.ts │ │ └── cart.module.ts │ ├── main.ts │ ├── models │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ ├── products.controller.ts │ └── validators │ │ ├── product.validator.ts │ │ └── user.validator.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── cart │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter26 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── cart │ │ ├── cart.controller.ts │ │ └── cart.module.ts │ ├── main.ts │ ├── models │ │ ├── item.entity.ts │ │ ├── order.entity.ts │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ ├── products.controller.ts │ └── validators │ │ ├── product.validator.ts │ │ └── user.validator.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── cart │ └── index.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter27 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── cart │ │ ├── cart.controller.ts │ │ └── cart.module.ts │ ├── main.ts │ ├── models │ │ ├── item.entity.ts │ │ ├── order.entity.ts │ │ ├── orders.service.ts │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ ├── products.controller.ts │ └── validators │ │ ├── product.validator.ts │ │ └── user.validator.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── cart │ ├── index.hbs │ └── purchase.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs ├── Chapter28 └── online-store │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── ormconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── css │ │ ├── admin.css │ │ └── app.css │ ├── img │ │ ├── game.png │ │ ├── safe.png │ │ ├── submarine.png │ │ └── undraw_profile.svg │ └── uploads │ │ ├── 0244acee2480c73d2b7ff13889339f63 │ │ ├── 3cd943b8570593a2123cf5b1c1f7f692 │ │ ├── 6a6361d282bd83a313510e10402eaafa │ │ ├── 72d058ba219a2148f248c580bc606a88 │ │ ├── bd7c11c5aeb2085e110acfc6567d6cc2 │ │ └── cb79a6bd2acc8bbaf8d639cd1c345935 │ ├── src │ ├── account │ │ ├── account.controller.ts │ │ └── account.module.ts │ ├── admin │ │ ├── admin.controller.ts │ │ ├── admin.module.ts │ │ └── admin.products.controller.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.controller.ts │ │ └── auth.module.ts │ ├── cart │ │ ├── cart.controller.ts │ │ └── cart.module.ts │ ├── main.ts │ ├── models │ │ ├── item.entity.ts │ │ ├── order.entity.ts │ │ ├── orders.service.ts │ │ ├── product.entity.ts │ │ ├── products.service.ts │ │ ├── user.entity.ts │ │ └── users.service.ts │ ├── products.controller.ts │ └── validators │ │ ├── product.validator.ts │ │ └── user.validator.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── views │ ├── about.hbs │ ├── account │ └── orders.hbs │ ├── admin │ ├── index.hbs │ └── products │ │ ├── edit.hbs │ │ └── index.hbs │ ├── auth │ ├── login.hbs │ └── register.hbs │ ├── cart │ ├── index.hbs │ └── purchase.hbs │ ├── index.hbs │ ├── layouts │ ├── admin.hbs │ └── app.hbs │ └── products │ ├── index.hbs │ └── show.hbs └── README.md /BookImages/Book images.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/BookImages/Book images.pdf -------------------------------------------------------------------------------- /Chapter03/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter03/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter03/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter03/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get() 6 | getHello(): string { 7 | return 'Hello World!'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter03/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /Chapter03/online-store/src/main.ts: -------------------------------------------------------------------------------- 1 | import { NestFactory } from '@nestjs/core'; 2 | import { AppModule } from './app.module'; 3 | 4 | async function bootstrap() { 5 | const app = await NestFactory.create(AppModule); 6 | await app.listen(3000); 7 | } 8 | bootstrap(); 9 | -------------------------------------------------------------------------------- /Chapter03/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter03/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter03/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter04/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter04/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter04/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter04/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get("/") 6 | @Render('index') 7 | index() {} 8 | } 9 | -------------------------------------------------------------------------------- /Chapter04/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /Chapter04/online-store/src/main.ts: -------------------------------------------------------------------------------- 1 | import { NestFactory } from '@nestjs/core'; 2 | import { AppModule } from './app.module'; 3 | import { NestExpressApplication } from '@nestjs/platform-express'; 4 | import { join } from 'path'; 5 | 6 | async function bootstrap() { 7 | const app = await NestFactory.create( 8 | AppModule, 9 | ); 10 | 11 | app.useStaticAssets(join(__dirname, '..', 'public')); 12 | app.setBaseViewsDir(join(__dirname, '..', 'views')); 13 | app.setViewEngine('hbs'); 14 | 15 | await app.listen(3000); 16 | } 17 | bootstrap(); 18 | -------------------------------------------------------------------------------- /Chapter04/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter04/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter04/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter04/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | Hello World! -------------------------------------------------------------------------------- /Chapter06/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter06/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter06/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter06/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter06/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get("/") 6 | @Render('index') 7 | index() {} 8 | } 9 | -------------------------------------------------------------------------------- /Chapter06/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /Chapter06/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter06/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter06/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter06/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | Welcome to the application 5 |
6 | {{/inline}} 7 | {{/app}} -------------------------------------------------------------------------------- /Chapter07/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter07/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter07/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter07/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter07/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter07/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter07/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter07/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter07/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter07/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter07/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get("/") 6 | @Render('index') 7 | index() { 8 | return { 9 | title: "Home Page - Online Store" 10 | }; 11 | } 12 | 13 | @Get("/about") 14 | @Render('about') 15 | about() { 16 | let viewData = []; 17 | viewData["description"] = "This is an about page ..."; 18 | viewData["author"] = "Developed by: Your Name"; 19 | let data1 = 'About us - Online Store'; 20 | return { 21 | title: data1, 22 | subtitle: "About us", 23 | viewData: viewData 24 | }; 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter07/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /Chapter07/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter07/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter07/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter07/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter07/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter08/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter08/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter08/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter08/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter08/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter08/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter08/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter08/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter08/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter08/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter08/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /Chapter08/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter08/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter08/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter08/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter08/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter09/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter09/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter09/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter09/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter09/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter09/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter09/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter09/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter09/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter09/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter09/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get('/') 6 | @Render('index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Home Page - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | 15 | @Get('/about') 16 | @Render('about') 17 | about() { 18 | const viewData = []; 19 | viewData['title'] = 'About us - Online Store'; 20 | viewData['subtitle'] = 'About us'; 21 | viewData['description'] = 'This is an about page ...'; 22 | viewData['author'] = 'Developed by: Your Name'; 23 | return { 24 | viewData: viewData, 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter09/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /Chapter09/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter09/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter09/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter09/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter09/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter10/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter10/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter10/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter10/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter10/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter10/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter10/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter10/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter10/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter10/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter10/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get('/') 6 | @Render('index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Home Page - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | 15 | @Get('/about') 16 | @Render('about') 17 | about() { 18 | const viewData = []; 19 | viewData['title'] = 'About us - Online Store'; 20 | viewData['subtitle'] = 'About us'; 21 | viewData['description'] = 'This is an about page ...'; 22 | viewData['author'] = 'Developed by: Your Name'; 23 | return { 24 | viewData: viewData, 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter10/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { ProductsController } from './products.controller'; 4 | 5 | @Module({ 6 | imports: [], 7 | controllers: [AppController, ProductsController], 8 | }) 9 | export class AppModule {} 10 | -------------------------------------------------------------------------------- /Chapter10/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter10/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter10/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter10/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter10/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter10/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{name}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter10/online-store/views/products/show.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 | {{#with viewData.product}} 4 |
5 |
6 |
7 | 8 |
9 |
10 |
11 |
12 | {{name}} (${{price}}) 13 |
14 |

{{description}}

15 |

Add to Cart

16 |
17 |
18 |
19 |
20 | {{/with}} 21 | {{/inline}} 22 | {{/app}} 23 | -------------------------------------------------------------------------------- /Chapter12/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter12/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter12/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter12/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter12/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter12/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter12/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter12/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter12/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter12/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter12/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter12/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get('/') 6 | @Render('index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Home Page - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | 15 | @Get('/about') 16 | @Render('about') 17 | about() { 18 | const viewData = []; 19 | viewData['title'] = 'About us - Online Store'; 20 | viewData['subtitle'] = 'About us'; 21 | viewData['description'] = 'This is an about page ...'; 22 | viewData['author'] = 'Developed by: Your Name'; 23 | return { 24 | viewData: viewData, 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter12/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { ProductsController } from './products.controller'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | 6 | @Module({ 7 | imports: [ 8 | TypeOrmModule.forRoot(), 9 | ], 10 | controllers: [AppController, ProductsController], 11 | }) 12 | export class AppModule {} 13 | -------------------------------------------------------------------------------- /Chapter12/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter12/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter12/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter12/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter12/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter12/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{name}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter12/online-store/views/products/show.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 | {{#with viewData.product}} 4 |
5 |
6 |
7 | 8 |
9 |
10 |
11 |
12 | {{name}} (${{price}}) 13 |
14 |

{{description}}

15 |

Add to Cart

16 |
17 |
18 |
19 |
20 | {{/with}} 21 | {{/inline}} 22 | {{/app}} 23 | -------------------------------------------------------------------------------- /Chapter13/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter13/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter13/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter13/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter13/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter13/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter13/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter13/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter13/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter13/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter13/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter13/online-store/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get('/') 6 | @Render('index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Home Page - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | 15 | @Get('/about') 16 | @Render('about') 17 | about() { 18 | const viewData = []; 19 | viewData['title'] = 'About us - Online Store'; 20 | viewData['subtitle'] = 'About us'; 21 | viewData['description'] = 'This is an about page ...'; 22 | viewData['author'] = 'Developed by: Your Name'; 23 | return { 24 | viewData: viewData, 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chapter13/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { ProductsController } from './products.controller'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | 6 | @Module({ 7 | imports: [ 8 | TypeOrmModule.forRoot(), 9 | ], 10 | controllers: [AppController, ProductsController], 11 | }) 12 | export class AppModule {} 13 | -------------------------------------------------------------------------------- /Chapter13/online-store/src/models/product.entity.ts: -------------------------------------------------------------------------------- 1 | import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; 2 | 3 | @Entity() 4 | export class Product { 5 | @PrimaryGeneratedColumn() 6 | id: number; 7 | 8 | @Column() 9 | name: string; 10 | 11 | @Column() 12 | description: string; 13 | 14 | @Column() 15 | image: string; 16 | 17 | @Column() 18 | price: number; 19 | } 20 | -------------------------------------------------------------------------------- /Chapter13/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter13/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter13/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter13/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter13/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter13/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{name}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter13/online-store/views/products/show.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 | {{#with viewData.product}} 4 |
5 |
6 |
7 | 8 |
9 |
10 |
11 |
12 | {{name}} (${{price}}) 13 |
14 |

{{description}}

15 |

Add to Cart

16 |
17 |
18 |
19 |
20 | {{/with}} 21 | {{/inline}} 22 | {{/app}} 23 | -------------------------------------------------------------------------------- /Chapter14/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter14/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter14/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter14/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter14/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter14/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter14/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter14/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter14/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter14/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter14/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter14/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { ProductsController } from './products.controller'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | import { ProductsService } from './models/products.service'; 6 | import { Product } from './models/product.entity'; 7 | 8 | @Module({ 9 | imports: [ 10 | TypeOrmModule.forRoot(), 11 | TypeOrmModule.forFeature([Product]), 12 | ], 13 | controllers: [AppController, ProductsController], 14 | providers: [ProductsService], 15 | }) 16 | export class AppModule {} 17 | -------------------------------------------------------------------------------- /Chapter14/online-store/src/models/product.entity.ts: -------------------------------------------------------------------------------- 1 | import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; 2 | 3 | @Entity() 4 | export class Product { 5 | @PrimaryGeneratedColumn() 6 | id: number; 7 | 8 | @Column() 9 | name: string; 10 | 11 | @Column() 12 | description: string; 13 | 14 | @Column() 15 | image: string; 16 | 17 | @Column() 18 | price: number; 19 | } 20 | -------------------------------------------------------------------------------- /Chapter14/online-store/src/models/products.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { Product } from './product.entity'; 5 | 6 | @Injectable() 7 | export class ProductsService { 8 | constructor( 9 | @InjectRepository(Product) 10 | private productsRepository: Repository, 11 | ) {} 12 | 13 | findAll(): Promise { 14 | return this.productsRepository.find(); 15 | } 16 | 17 | findOne(id: string): Promise { 18 | return this.productsRepository.findOne(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Chapter14/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter14/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter14/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter14/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter14/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter14/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{name}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter15/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter15/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter15/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter15/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter15/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter15/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter15/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter15/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter15/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter15/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter15/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter15/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { ProductsController } from './products.controller'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | import { ProductsService } from './models/products.service'; 6 | import { Product } from './models/product.entity'; 7 | 8 | @Module({ 9 | imports: [ 10 | TypeOrmModule.forRoot(), 11 | TypeOrmModule.forFeature([Product]), 12 | ], 13 | controllers: [AppController, ProductsController], 14 | providers: [ProductsService], 15 | }) 16 | export class AppModule {} 17 | -------------------------------------------------------------------------------- /Chapter15/online-store/src/models/products.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { Product } from './product.entity'; 5 | 6 | @Injectable() 7 | export class ProductsService { 8 | constructor( 9 | @InjectRepository(Product) 10 | private productsRepository: Repository, 11 | ) {} 12 | 13 | findAll(): Promise { 14 | return this.productsRepository.find(); 15 | } 16 | 17 | findOne(id: string): Promise { 18 | return this.productsRepository.findOne(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Chapter15/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter15/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter15/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter15/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter15/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter15/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter16/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter16/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter16/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter16/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter16/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter16/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter16/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter16/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter16/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter16/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter16/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter16/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter16/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter16/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | 4 | @Module({ 5 | controllers: [AdminController], 6 | }) 7 | export class AdminModule {} 8 | -------------------------------------------------------------------------------- /Chapter16/online-store/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { ProductsController } from './products.controller'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | import { ProductsService } from './models/products.service'; 6 | import { Product } from './models/product.entity'; 7 | import { AdminModule } from './admin/admin.module'; 8 | 9 | @Module({ 10 | imports: [ 11 | TypeOrmModule.forRoot(), 12 | TypeOrmModule.forFeature([Product]), 13 | AdminModule, 14 | ], 15 | controllers: [AppController, ProductsController], 16 | providers: [ProductsService], 17 | }) 18 | export class AppModule {} 19 | -------------------------------------------------------------------------------- /Chapter16/online-store/src/models/products.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { Product } from './product.entity'; 5 | 6 | @Injectable() 7 | export class ProductsService { 8 | constructor( 9 | @InjectRepository(Product) 10 | private productsRepository: Repository, 11 | ) {} 12 | 13 | findAll(): Promise { 14 | return this.productsRepository.find(); 15 | } 16 | 17 | findOne(id: string): Promise { 18 | return this.productsRepository.findOne(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Chapter16/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter16/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter16/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter16/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter16/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter16/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter16/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter17/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter17/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter17/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter17/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter17/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter17/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter17/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter17/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter17/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter17/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter17/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter17/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter17/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter17/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter17/online-store/src/admin/admin.products.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | import { ProductsService } from '../models/products.service'; 3 | 4 | @Controller('/admin/products') 5 | export class AdminProductsController { 6 | constructor(private readonly productsService: ProductsService) {} 7 | 8 | @Get('/') 9 | @Render('admin/products/index') 10 | async index() { 11 | const viewData = []; 12 | viewData['title'] = 'Admin Page - Admin - Online Store'; 13 | viewData['products'] = await this.productsService.findAll(); 14 | return { 15 | viewData: viewData, 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Chapter17/online-store/src/models/products.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { Product } from './product.entity'; 5 | 6 | @Injectable() 7 | export class ProductsService { 8 | constructor( 9 | @InjectRepository(Product) 10 | private productsRepository: Repository, 11 | ) {} 12 | 13 | findAll(): Promise { 14 | return this.productsRepository.find(); 15 | } 16 | 17 | findOne(id: string): Promise { 18 | return this.productsRepository.findOne(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Chapter17/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter17/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter17/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter17/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter17/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter17/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter17/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter18/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter18/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter18/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter18/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter18/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter18/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter18/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter18/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter18/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter18/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter18/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter18/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter18/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter18/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter18/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter18/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter18/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter18/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter18/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter18/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter18/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter19/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter19/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter19/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter19/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter19/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter19/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter19/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter19/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter19/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter19/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter19/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter19/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter19/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter19/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter19/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter19/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter19/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter19/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter19/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter19/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter19/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter19/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter19/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter20/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter20/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter20/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter20/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter20/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter20/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter20/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter20/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter20/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter20/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter20/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter20/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter20/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter20/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter20/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter20/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter20/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter20/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter20/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter20/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter20/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter20/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter20/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter20/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter20/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter21/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter21/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter21/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter21/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter21/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter21/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter21/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter21/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter21/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter21/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter21/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter21/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter21/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter21/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter21/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter21/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter21/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter21/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter21/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter21/online-store/src/models/users.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { User } from './user.entity'; 5 | import * as bcrypt from 'bcrypt'; 6 | 7 | @Injectable() 8 | export class UsersService { 9 | constructor( 10 | @InjectRepository(User) 11 | private usersRepository: Repository, 12 | ) {} 13 | 14 | async createOrUpdate(user: User): Promise { 15 | const hash = await bcrypt.hash(user.getPassword(), 10); 16 | user.setPassword(hash); 17 | return this.usersRepository.save(user); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Chapter21/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter21/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter21/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter21/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter21/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter21/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter21/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter22/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter22/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter22/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter22/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter22/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter22/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter22/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter22/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter22/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter22/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter22/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter22/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter22/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter22/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter22/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter22/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter22/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter22/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter22/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter22/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter22/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter22/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter22/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter22/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter22/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter22/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter23/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter23/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter23/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter23/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter23/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter23/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter23/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter23/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter23/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter23/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter23/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter23/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter23/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter23/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter23/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter23/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter23/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter23/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter23/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter23/online-store/src/validators/user.validator.ts: -------------------------------------------------------------------------------- 1 | import validator from 'validator'; 2 | 3 | export class UserValidator { 4 | static validate(body, toValidate: string[]) { 5 | const errors: string[] = []; 6 | 7 | if (toValidate.includes('name') && validator.isEmpty(body.name)) { 8 | errors.push('Name cannot be empty'); 9 | } 10 | 11 | if (toValidate.includes('email') && !validator.isEmail(body.email)) { 12 | errors.push('Invalid Email format'); 13 | } 14 | 15 | if ( 16 | toValidate.includes('password') && 17 | validator.isEmpty(body.password) 18 | ) { 19 | errors.push('Password cannot be empty'); 20 | } 21 | 22 | return errors; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter23/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter23/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter23/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter23/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter23/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter23/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter23/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter24/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter24/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter24/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter24/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter24/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter24/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter24/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter24/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter24/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter24/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter24/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter24/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter24/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter24/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter24/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter24/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter24/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter24/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter24/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter24/online-store/src/validators/user.validator.ts: -------------------------------------------------------------------------------- 1 | import validator from 'validator'; 2 | 3 | export class UserValidator { 4 | static validate(body, toValidate: string[]) { 5 | const errors: string[] = []; 6 | 7 | if (toValidate.includes('name') && validator.isEmpty(body.name)) { 8 | errors.push('Name cannot be empty'); 9 | } 10 | 11 | if (toValidate.includes('email') && !validator.isEmail(body.email)) { 12 | errors.push('Invalid Email format'); 13 | } 14 | 15 | if ( 16 | toValidate.includes('password') && 17 | validator.isEmpty(body.password) 18 | ) { 19 | errors.push('Password cannot be empty'); 20 | } 21 | 22 | return errors; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter24/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter24/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter24/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter24/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter24/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter24/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter24/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter25/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter25/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter25/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter25/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter25/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter25/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter25/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter25/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter25/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter25/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter25/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter25/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter25/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter25/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter25/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter25/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter25/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter25/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter25/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter25/online-store/src/cart/cart.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { CartController } from './cart.controller'; 3 | 4 | @Module({ 5 | controllers: [CartController], 6 | }) 7 | export class CartModule {} 8 | -------------------------------------------------------------------------------- /Chapter25/online-store/src/validators/user.validator.ts: -------------------------------------------------------------------------------- 1 | import validator from 'validator'; 2 | 3 | export class UserValidator { 4 | static validate(body, toValidate: string[]) { 5 | const errors: string[] = []; 6 | 7 | if (toValidate.includes('name') && validator.isEmpty(body.name)) { 8 | errors.push('Name cannot be empty'); 9 | } 10 | 11 | if (toValidate.includes('email') && !validator.isEmail(body.email)) { 12 | errors.push('Invalid Email format'); 13 | } 14 | 15 | if ( 16 | toValidate.includes('password') && 17 | validator.isEmpty(body.password) 18 | ) { 19 | errors.push('Password cannot be empty'); 20 | } 21 | 22 | return errors; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter25/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter25/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter25/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter25/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter25/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter25/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter25/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter26/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter26/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter26/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter26/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter26/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter26/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter26/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter26/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter26/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter26/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter26/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter26/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter26/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter26/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter26/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter26/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter26/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter26/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter26/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter26/online-store/src/cart/cart.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { CartController } from './cart.controller'; 3 | 4 | @Module({ 5 | controllers: [CartController], 6 | }) 7 | export class CartModule {} 8 | -------------------------------------------------------------------------------- /Chapter26/online-store/src/validators/user.validator.ts: -------------------------------------------------------------------------------- 1 | import validator from 'validator'; 2 | 3 | export class UserValidator { 4 | static validate(body, toValidate: string[]) { 5 | const errors: string[] = []; 6 | 7 | if (toValidate.includes('name') && validator.isEmpty(body.name)) { 8 | errors.push('Name cannot be empty'); 9 | } 10 | 11 | if (toValidate.includes('email') && !validator.isEmail(body.email)) { 12 | errors.push('Invalid Email format'); 13 | } 14 | 15 | if ( 16 | toValidate.includes('password') && 17 | validator.isEmpty(body.password) 18 | ) { 19 | errors.push('Password cannot be empty'); 20 | } 21 | 22 | return errors; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter26/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter26/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter26/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter26/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter26/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter26/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter26/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter27/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter27/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter27/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter27/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter27/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter27/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter27/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter27/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter27/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter27/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter27/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter27/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter27/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter27/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter27/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter27/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter27/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter27/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter27/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter27/online-store/src/cart/cart.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { CartController } from './cart.controller'; 3 | 4 | @Module({ 5 | controllers: [CartController], 6 | }) 7 | export class CartModule {} 8 | -------------------------------------------------------------------------------- /Chapter27/online-store/src/models/orders.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { Order } from './order.entity'; 5 | 6 | @Injectable() 7 | export class OrdersService { 8 | constructor( 9 | @InjectRepository(Order) 10 | private ordersRepository: Repository, 11 | ) {} 12 | 13 | createOrUpdate(order: Order): Promise { 14 | return this.ordersRepository.save(order); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Chapter27/online-store/src/validators/user.validator.ts: -------------------------------------------------------------------------------- 1 | import validator from 'validator'; 2 | 3 | export class UserValidator { 4 | static validate(body, toValidate: string[]) { 5 | const errors: string[] = []; 6 | 7 | if (toValidate.includes('name') && validator.isEmpty(body.name)) { 8 | errors.push('Name cannot be empty'); 9 | } 10 | 11 | if (toValidate.includes('email') && !validator.isEmail(body.email)) { 12 | errors.push('Invalid Email format'); 13 | } 14 | 15 | if ( 16 | toValidate.includes('password') && 17 | validator.isEmpty(body.password) 18 | ) { 19 | errors.push('Password cannot be empty'); 20 | } 21 | 22 | return errors; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter27/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter27/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter27/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter27/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter27/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter27/online-store/views/cart/purchase.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Purchase Completed 6 |
7 |
8 | 11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter27/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter27/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | -------------------------------------------------------------------------------- /Chapter28/online-store/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /Chapter28/online-store/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /Chapter28/online-store/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /Chapter28/online-store/ormconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "mysql", 3 | "host": "localhost", 4 | "port": 3306, 5 | "username": "root", 6 | "password": "", 7 | "database": "online_store", 8 | "entities": ["dist/**/*.entity{.ts,.js}"], 9 | "synchronize": true 10 | } -------------------------------------------------------------------------------- /Chapter28/online-store/public/css/admin.css: -------------------------------------------------------------------------------- 1 | .copyright { 2 | background-color: #1a252f; 3 | } 4 | 5 | .fixed { 6 | -ms-flex: 0 0 250px; 7 | flex: 0 0 250px; 8 | } 9 | 10 | .content-grey { 11 | background-color: #f8f9fc; 12 | } 13 | 14 | hr { 15 | margin-top: 0.8em; 16 | margin-bottom: 0.8em; 17 | } 18 | 19 | .img-profile { 20 | height: 2rem; 21 | width: 2rem; 22 | } 23 | 24 | .profile-font { 25 | color: #858796 !important; 26 | font-size: 80%; 27 | font-weight: 400; 28 | } 29 | 30 | .card-header { 31 | background-color: #f8f9fc; 32 | border-bottom: 1px solid #e3e6f0; 33 | } 34 | -------------------------------------------------------------------------------- /Chapter28/online-store/public/css/app.css: -------------------------------------------------------------------------------- 1 | .bg-secondary { 2 | background-color: #2c3e50 !important; 3 | } 4 | 5 | .copyright { 6 | background-color: #1a252f; 7 | } 8 | 9 | .bg-primary { 10 | background-color: #1abc9c !important; 11 | } 12 | 13 | nav { 14 | font-weight: 700; 15 | } 16 | 17 | .img-card { 18 | height: 18vw; 19 | object-fit: cover; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter28/online-store/public/img/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/img/game.png -------------------------------------------------------------------------------- /Chapter28/online-store/public/img/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/img/safe.png -------------------------------------------------------------------------------- /Chapter28/online-store/public/img/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/img/submarine.png -------------------------------------------------------------------------------- /Chapter28/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/uploads/0244acee2480c73d2b7ff13889339f63 -------------------------------------------------------------------------------- /Chapter28/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/uploads/3cd943b8570593a2123cf5b1c1f7f692 -------------------------------------------------------------------------------- /Chapter28/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/uploads/6a6361d282bd83a313510e10402eaafa -------------------------------------------------------------------------------- /Chapter28/online-store/public/uploads/72d058ba219a2148f248c580bc606a88: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/uploads/72d058ba219a2148f248c580bc606a88 -------------------------------------------------------------------------------- /Chapter28/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/uploads/bd7c11c5aeb2085e110acfc6567d6cc2 -------------------------------------------------------------------------------- /Chapter28/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PracticalBooks/Practical-Nest/93bf29ea0e6e82e2fce06dabf18794946845b90a/Chapter28/online-store/public/uploads/cb79a6bd2acc8bbaf8d639cd1c345935 -------------------------------------------------------------------------------- /Chapter28/online-store/src/account/account.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render, Req } from '@nestjs/common'; 2 | import { OrdersService } from '../models/orders.service'; 3 | 4 | @Controller('/account') 5 | export class AccountController { 6 | constructor(private readonly ordersService: OrdersService) {} 7 | 8 | @Get('/orders') 9 | @Render('account/orders') 10 | async orders(@Req() request) { 11 | const viewData = []; 12 | viewData['title'] = 'My Orders - Online Store'; 13 | viewData['subtitle'] = 'My Orders'; 14 | viewData['orders'] = await this.ordersService.findByUserId( 15 | request.session.user.id, 16 | ); 17 | return { 18 | viewData: viewData, 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter28/online-store/src/account/account.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AccountController } from './account.controller'; 3 | 4 | @Module({ 5 | controllers: [AccountController], 6 | }) 7 | export class AccountModule {} 8 | -------------------------------------------------------------------------------- /Chapter28/online-store/src/admin/admin.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Render } from '@nestjs/common'; 2 | 3 | @Controller('/admin') 4 | export class AdminController { 5 | @Get('/') 6 | @Render('admin/index') 7 | index() { 8 | const viewData = []; 9 | viewData['title'] = 'Admin Page - Admin - Online Store'; 10 | return { 11 | viewData: viewData, 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Chapter28/online-store/src/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AdminController } from './admin.controller'; 3 | import { AdminProductsController } from './admin.products.controller'; 4 | 5 | @Module({ 6 | controllers: [AdminController, AdminProductsController], 7 | }) 8 | export class AdminModule {} 9 | -------------------------------------------------------------------------------- /Chapter28/online-store/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | @Module({ 5 | controllers: [AuthController], 6 | }) 7 | export class AuthModule {} 8 | -------------------------------------------------------------------------------- /Chapter28/online-store/src/cart/cart.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { CartController } from './cart.controller'; 3 | 4 | @Module({ 5 | controllers: [CartController], 6 | }) 7 | export class CartModule {} 8 | -------------------------------------------------------------------------------- /Chapter28/online-store/src/validators/user.validator.ts: -------------------------------------------------------------------------------- 1 | import validator from 'validator'; 2 | 3 | export class UserValidator { 4 | static validate(body, toValidate: string[]) { 5 | const errors: string[] = []; 6 | 7 | if (toValidate.includes('name') && validator.isEmpty(body.name)) { 8 | errors.push('Name cannot be empty'); 9 | } 10 | 11 | if (toValidate.includes('email') && !validator.isEmail(body.email)) { 12 | errors.push('Invalid Email format'); 13 | } 14 | 15 | if ( 16 | toValidate.includes('password') && 17 | validator.isEmpty(body.password) 18 | ) { 19 | errors.push('Password cannot be empty'); 20 | } 21 | 22 | return errors; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter28/online-store/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter28/online-store/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /Chapter28/online-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Chapter28/online-store/views/about.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 |
6 |

{{ viewData.description }}

7 |
8 |
9 |

{{ viewData.author }}

10 |
11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter28/online-store/views/admin/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> admin}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Admin Panel - Home Page 6 |
7 |
8 | Welcome to the Admin Panel, use the sidebar to navigate between the different options. 9 |
10 |
11 | {{/inline}} 12 | {{/admin}} 13 | -------------------------------------------------------------------------------- /Chapter28/online-store/views/cart/purchase.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | Purchase Completed 6 |
7 |
8 | 11 |
12 |
13 | {{/inline}} 14 | {{/app}} 15 | -------------------------------------------------------------------------------- /Chapter28/online-store/views/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 | {{/inline}} 15 | {{/app}} -------------------------------------------------------------------------------- /Chapter28/online-store/views/products/index.hbs: -------------------------------------------------------------------------------- 1 | {{#> app}} 2 | {{#*inline "content"}} 3 |
4 | {{#each viewData.products}} 5 |
6 |
7 | 8 |
9 | {{getName}} 10 |
11 |
12 |
13 | {{/each}} 14 |
15 | {{/inline}} 16 | {{/app}} 17 | --------------------------------------------------------------------------------