diff --git a/README.md b/README.md index 7e339ef..3e1cd2e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This goal of this project is to help you get better at Angular and NgRx buy reso Projection Directive enhancement Directive enhancement -http +crud application
NgRx diff --git a/apps/http/.browserslistrc b/apps/crud/.browserslistrc similarity index 100% rename from apps/http/.browserslistrc rename to apps/crud/.browserslistrc diff --git a/apps/http/.eslintrc.json b/apps/crud/.eslintrc.json similarity index 100% rename from apps/http/.eslintrc.json rename to apps/crud/.eslintrc.json diff --git a/apps/http/README.md b/apps/crud/README.md similarity index 76% rename from apps/http/README.md rename to apps/crud/README.md index ee0b5fd..b768010 100644 --- a/apps/http/README.md +++ b/apps/crud/README.md @@ -1,10 +1,10 @@ -

HttpClient

+

CRUD application with local store

> Author: Thomas Laforge ## Information -Http request is the heart of any application. You will need to master those following best practises to build strong and reliable Angular Application. +Communicating and having a global/local state in sync with your backend is the heart of any application. You will need to master those following best practises to build strong and reliable Angular Application. ## Statement @@ -17,7 +17,7 @@ Currently we have a working exemple but filled with lots of bad practices. What you will need to do: - Avoid **any** as a type. Using Interface to leverage Typescript type system prevent errors -- Use a **separate service** for all your http calls and use a **BehaviourSubject** for your todoList +- Use a **separate service** for all your crud calls and use a **BehaviourSubject** for your todoList - Use **AsyncPipe** to suscribe to your todo list. _(Let you handle subscription, unsuscription and refresh of the page when data has changed)_, avoir manual subscribe when it's not needed - Don't **mutate** data @@ -36,7 +36,7 @@ this.todos = [ ### Step 2: Improve -- Add a **Delete** button: _Doc of fake API_ +- Add a **Delete** button: _Doc of fake API_ - Handle **errors** correctly. _(Globaly)_ - Add a Global **loading** indicator. _You can use MatProgressSpinnerModule_ @@ -54,11 +54,11 @@ this.todos = [ 1. Fork the project 2. clone it 3. npm install -4. **nx serve http** +4. **nx serve crud** 5. _...work On it_ 6. Commit your work 7. Submit a PR with a title beginning with **Answer:3** that I will review and other dev can review. -Http +Http -_You can ask any question on_ Twitter +_You can ask any question on_ Twitter diff --git a/apps/http/project.json b/apps/crud/project.json similarity index 64% rename from apps/http/project.json rename to apps/crud/project.json index 1bd6721..675e401 100644 --- a/apps/http/project.json +++ b/apps/crud/project.json @@ -1,34 +1,27 @@ { - "name": "http", + "name": "crud", "$schema": "../../node_modules/nx/schemas/project-schema.json", "projectType": "application", - "sourceRoot": "apps/http/src", + "sourceRoot": "apps/crud/src", "prefix": "app", "targets": { "build": { "executor": "@angular-devkit/build-angular:browser", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/apps/http", - "index": "apps/http/src/index.html", - "main": "apps/http/src/main.ts", - "polyfills": "apps/http/src/polyfills.ts", - "tsConfig": "apps/http/tsconfig.app.json", + "outputPath": "dist/apps/crud", + "index": "apps/crud/src/index.html", + "main": "apps/crud/src/main.ts", + "polyfills": "apps/crud/src/polyfills.ts", + "tsConfig": "apps/crud/tsconfig.app.json", "inlineStyleLanguage": "scss", - "assets": [ - "apps/http/src/favicon.ico", - "apps/http/src/assets" - ], + "assets": ["apps/crud/src/favicon.ico", "apps/crud/src/assets"], "styles": [ "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", - "apps/http/src/styles.scss" + "apps/crud/src/styles.scss" ], "scripts": [], - "allowedCommonJsDependencies": [ - "seedrandom" - ] + "allowedCommonJsDependencies": ["seedrandom"] }, "configurations": { "production": { @@ -46,8 +39,8 @@ ], "fileReplacements": [ { - "replace": "apps/http/src/environments/environment.ts", - "with": "apps/http/src/environments/environment.prod.ts" + "replace": "apps/crud/src/environments/environment.ts", + "with": "apps/crud/src/environments/environment.prod.ts" } ], "outputHashing": "all" @@ -67,10 +60,10 @@ "executor": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "http:build:production" + "browserTarget": "crud:build:production" }, "development": { - "browserTarget": "http:build:development" + "browserTarget": "crud:build:development" } }, "defaultConfiguration": "development" @@ -78,16 +71,13 @@ "extract-i18n": { "executor": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "http:build" + "browserTarget": "crud:build" } }, "lint": { "executor": "@nrwl/linter:eslint", "options": { - "lintFilePatterns": [ - "apps/http/**/*.ts", - "apps/http/**/*.html" - ] + "lintFilePatterns": ["apps/crud/**/*.ts", "apps/crud/**/*.html"] } } }, diff --git a/apps/http/src/app/app.component.ts b/apps/crud/src/app/app.component.ts similarity index 100% rename from apps/http/src/app/app.component.ts rename to apps/crud/src/app/app.component.ts diff --git a/apps/http/src/assets/.gitkeep b/apps/crud/src/assets/.gitkeep similarity index 100% rename from apps/http/src/assets/.gitkeep rename to apps/crud/src/assets/.gitkeep diff --git a/apps/http/src/environments/environment.prod.ts b/apps/crud/src/environments/environment.prod.ts similarity index 100% rename from apps/http/src/environments/environment.prod.ts rename to apps/crud/src/environments/environment.prod.ts diff --git a/apps/http/src/environments/environment.ts b/apps/crud/src/environments/environment.ts similarity index 100% rename from apps/http/src/environments/environment.ts rename to apps/crud/src/environments/environment.ts diff --git a/apps/http/src/favicon.ico b/apps/crud/src/favicon.ico similarity index 100% rename from apps/http/src/favicon.ico rename to apps/crud/src/favicon.ico diff --git a/apps/http/src/index.html b/apps/crud/src/index.html similarity index 51% rename from apps/http/src/index.html rename to apps/crud/src/index.html index bd885fc..601c359 100644 --- a/apps/http/src/index.html +++ b/apps/crud/src/index.html @@ -6,9 +6,13 @@ - - - + + + diff --git a/apps/http/src/main.ts b/apps/crud/src/main.ts similarity index 100% rename from apps/http/src/main.ts rename to apps/crud/src/main.ts diff --git a/apps/http/src/polyfills.ts b/apps/crud/src/polyfills.ts similarity index 100% rename from apps/http/src/polyfills.ts rename to apps/crud/src/polyfills.ts diff --git a/apps/http/src/styles.scss b/apps/crud/src/styles.scss similarity index 53% rename from apps/http/src/styles.scss rename to apps/crud/src/styles.scss index 7e087c3..5fb5bb0 100644 --- a/apps/http/src/styles.scss +++ b/apps/crud/src/styles.scss @@ -1,10 +1,10 @@ /* You can add global styles to this file, and also import other style files */ html, body { - height: 100%; + height: 100%; } body { - margin: 0; - font-family: Roboto, "Helvetica Neue", sans-serif; -} \ No newline at end of file + margin: 0; + font-family: Roboto, 'Helvetica Neue', sans-serif; +} diff --git a/apps/http/tsconfig.app.json b/apps/crud/tsconfig.app.json similarity index 100% rename from apps/http/tsconfig.app.json rename to apps/crud/tsconfig.app.json diff --git a/apps/http/tsconfig.editor.json b/apps/crud/tsconfig.editor.json similarity index 100% rename from apps/http/tsconfig.editor.json rename to apps/crud/tsconfig.editor.json diff --git a/apps/http/tsconfig.json b/apps/crud/tsconfig.json similarity index 100% rename from apps/http/tsconfig.json rename to apps/crud/tsconfig.json