├── remote-container ├── .prettierrc ├── nest-cli.json ├── slides.pdf ├── tsconfig.build.json ├── src │ ├── app.service.ts │ ├── main.ts │ ├── app.module.ts │ ├── app.controller.ts │ └── app.controller.spec.ts ├── test │ ├── jest-e2e.json │ └── app.e2e-spec.ts ├── tsconfig.json ├── .gitignore ├── .vscode │ └── settings.json ├── .eslintrc.js ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── package.json └── README.md ├── WSL 2 com Docker ├── slides.pdf └── Ambiente de desenvolvimento com WSL 2 e Docker.pdf:Zone.Identifier ├── iniciando-typescript ├── slides.pdf ├── dist │ ├── index.html │ ├── index.js.map │ └── index.js ├── tsconfig.json ├── .vscode │ └── settings.json └── src │ └── index.ts └── README.md /remote-container/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /remote-container/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /WSL 2 com Docker/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeedu/avancadev-edicao1/HEAD/WSL 2 com Docker/slides.pdf -------------------------------------------------------------------------------- /remote-container/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeedu/avancadev-edicao1/HEAD/remote-container/slides.pdf -------------------------------------------------------------------------------- /iniciando-typescript/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeedu/avancadev-edicao1/HEAD/iniciando-typescript/slides.pdf -------------------------------------------------------------------------------- /iniciando-typescript/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | -------------------------------------------------------------------------------- /remote-container/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /remote-container/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | 3 | @Injectable() 4 | export class AppService { 5 | getHello(): string { 6 | return 'Hello World!'; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /remote-container/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 | -------------------------------------------------------------------------------- /remote-container/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 | -------------------------------------------------------------------------------- /iniciando-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmitOnError": true, 4 | "strictNullChecks": true, 5 | "noImplicitAny": true, 6 | "outDir": "dist", 7 | "sourceMap": true 8 | }, 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /remote-container/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | @Module({ 6 | imports: [], 7 | controllers: [AppController], 8 | providers: [AppService], 9 | }) 10 | export class AppModule {} 11 | -------------------------------------------------------------------------------- /remote-container/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 4 | 5 | ## Descrição 6 | 7 | Fontes do Esquenta do Avança Dev 1.0 8 | 9 | ## Slides 10 | 11 | Se a live teve slides, terá um arquivo slides.pdf no projeto. 12 | -------------------------------------------------------------------------------- /remote-container/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 | } 15 | } 16 | -------------------------------------------------------------------------------- /remote-container/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json -------------------------------------------------------------------------------- /remote-container/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#fc7d6d", 4 | "activityBar.activeBorder": "#a1fdac", 5 | "activityBar.background": "#fc7d6d", 6 | "activityBar.foreground": "#15202b", 7 | "activityBar.inactiveForeground": "#15202b99", 8 | "activityBarBadge.background": "#a1fdac", 9 | "activityBarBadge.foreground": "#15202b", 10 | "statusBar.background": "#fc7d6d", 11 | "statusBar.foreground": "#15202b", 12 | "statusBarItem.hoverBackground": "#fb503b" 13 | }, 14 | "peacock.remoteColor": "#fb503b" 15 | } -------------------------------------------------------------------------------- /iniciando-typescript/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#0098ff", 4 | "activityBar.activeBorder": "#bf0072", 5 | "activityBar.background": "#0098ff", 6 | "activityBar.foreground": "#e7e7e7", 7 | "activityBar.inactiveForeground": "#e7e7e799", 8 | "activityBarBadge.background": "#bf0072", 9 | "activityBarBadge.foreground": "#e7e7e7", 10 | "statusBar.background": "#0098ff", 11 | "statusBar.foreground": "#e7e7e7", 12 | "statusBarItem.hoverBackground": "#33adff" 13 | }, 14 | "peacock.remoteColor": "#007acc" 15 | } -------------------------------------------------------------------------------- /remote-container/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.getA progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
11 | 24 | 26 | 27 | ## Description 28 | 29 | [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. 30 | 31 | ## Installation 32 | 33 | ```bash 34 | $ npm install 35 | ``` 36 | 37 | ## Running the app 38 | 39 | ```bash 40 | # development 41 | $ npm run start 42 | 43 | # watch mode 44 | $ npm run start:dev 45 | 46 | # production mode 47 | $ npm run start:prod 48 | ``` 49 | 50 | ## Test 51 | 52 | ```bash 53 | # unit tests 54 | $ npm run test 55 | 56 | # e2e tests 57 | $ npm run test:e2e 58 | 59 | # test coverage 60 | $ npm run test:cov 61 | ``` 62 | 63 | ## Support 64 | 65 | Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). 66 | 67 | ## Stay in touch 68 | 69 | - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) 70 | - Website - [https://nestjs.com](https://nestjs.com/) 71 | - Twitter - [@nestframework](https://twitter.com/nestframework) 72 | 73 | ## License 74 | 75 | Nest is [MIT licensed](LICENSE). 76 | -------------------------------------------------------------------------------- /iniciando-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /* ### TIPOS PRIMITIVOS */ 2 | //let, const e var 3 | type Primitive = string | boolean | number | bigint | symbol | null | undefined; 4 | 5 | /* ### QUALQUER OUTRO TIPO É NÃO PRIMITIVO 6 | * - Object (nativo do JavaScript, não deve ser usado para tipagem) 7 | * - object (pode ser usado para tipagem) 8 | * - Class 9 | * - qualquer outra modelagem de object 10 | */ 11 | 12 | /* ### TIPOS IMPLÍCITOS E EXPLÍCITOS */ 13 | 14 | const impl_string = "typescript"; //string 15 | const impl_number = 5.5; //number 16 | const impl_boolean = true; //boolean 17 | const impl_obj = { name: "typescript" }; // {name: string} 18 | 19 | const expl_string: string = "typescript"; 20 | const expl_number: number = 5.5; 21 | const expl_boolean: boolean = true; 22 | const expl_obj: { name: string } = { name: "typescript" }; 23 | 24 | /* ### INTERFACES */ 25 | 26 | interface AddressInterface { 27 | address: string; 28 | city: string; 29 | } 30 | 31 | //type 32 | interface UserInterface { 33 | firstName: string; 34 | lastName: string; 35 | fullName: () => string; 36 | address?: AddressInterface; 37 | } 38 | 39 | 40 | const obj: UserInterface = { 41 | firstName: "luiz", 42 | lastName: "diniz", 43 | fullName: () => { 44 | return "luiz carlos"; // 45 | }, 46 | //address não é obrigatório 47 | // address: { 48 | // address: "rua x", 49 | // city: "betim" 50 | // } 51 | }; 52 | 53 | console.log("obj - user", obj); 54 | 55 | /* ### OPTIONAL CHAINING (PROPOSTA PARA ECMASCRIPT) */ 56 | const city = obj.address?.city; 57 | 58 | console.log("city", city); 59 | 60 | /* ### NULLISH COALESCING (PROPOSTA PARA ECMASCRIPT) */ 61 | 62 | const cityLabel = city ?? "sem cidade"; 63 | 64 | console.log(cityLabel); 65 | 66 | /* ### NON-NULL ASSERTION (PROPOSTA PARA ECMASCRIPT) */ 67 | 68 | function addAddress(obj: UserInterface): void { 69 | obj.address = { address: "rua x", city: "betim" }; 70 | } 71 | addAddress(obj); 72 | 73 | const cityNonNull = obj.address!.city; 74 | //obj.address!.city = "valor" 75 | console.log("cityNonNull", cityNonNull); 76 | 77 | const num1: number | undefined = undefined; 78 | 79 | const num2: number = num1!; 80 | 81 | console.log(num2); 82 | 83 | /* ### FUNÇÕES 84 | * Funções recebem parâmetros que podem ser tipados normalmente e 85 | * pode-se determinar o tipo de retorno com um tipo primitivo ou não-primitivo 86 | */ 87 | function soma(a: number, b: number): number { 88 | return a + b; 89 | } 90 | 91 | //parâmetro lastName é opcional 92 | function fullName(firstName: string, lastName?: string): string { 93 | return lastName === undefined ? firstName : `${firstName} ${lastName}`; 94 | } 95 | 96 | console.log("fullname", fullName("luiz", "diniz")); 97 | 98 | /* ### CLASSES 99 | * O suporte a classes vem antes da ES6. 100 | * É suportado tudo que é possível fazer com classes na ES6 + 101 | * os recursos do próprio TypeScript. 102 | */ 103 | 104 | interface BaseCrudInterface { 105 | //@ts-ignore 106 | create(data: object); 107 | fetch(filter: object): UserInterface[]; 108 | find(id: string): UserInterface; 109 | } 110 | 111 | class UserCrud implements BaseCrudInterface { 112 | private variavel: string = 'valor'; 113 | private variavel1: number; 114 | 115 | constructor( 116 | private name: string, 117 | private email: string, 118 | private password: string 119 | ) { 120 | 121 | } 122 | create(data: object) { 123 | throw new Error("Method not implemented."); 124 | } 125 | fetch(filter: object): UserInterface[] { 126 | throw new Error("Method not implemented."); 127 | } 128 | find(id: string): UserInterface { 129 | throw new Error("Method not implemented."); 130 | } 131 | 132 | } 133 | const user = new UserCrud('', '', ''); 134 | //user. 135 | 136 | /* ### ANY */ 137 | 138 | let variavel; 139 | 140 | variavel = "luiz carlos"; 141 | 142 | variavel = 5.5 143 | 144 | variavel = true 145 | 146 | const variavel2 = 56; 147 | 148 | // const variavel3: any = variavel2; 149 | // variavel3.existe('') 150 | 151 | (variavel2 as any).existe(' ') 152 | 153 | function soma1(a: any, b: any){ 154 | return a+b; 155 | } 156 | 157 | //soma1("luiz", "diniz"); 158 | 159 | 160 | --------------------------------------------------------------------------------