Un’applicazione di test con Django e Angular (Parte 2) – Frontend Angular

angular

Prima di tutto, è necessario installare Node.js (https://nodejs.org/). Puoi seguire le istruzioni in questa pagina https://nodejs.org/en/download.

Una volta installato Node.js, dovrai installare il pacchetto @angular/cli https://angular.dev/tools/cli. Angular CLI è lo strumento che permette di creare, gestire e mantenere le applicazioni Angular direttamente dalla riga di comando.

# npm install -g @angular/cli

added 275 packages in 6s

52 packages are looking for funding
  run `npm fund` for details

Dopo aver installato @angular/cli, puoi inizializzare una nuova applicazione chiamata “library_web”.

# ng new library_web
? Which stylesheet format would you like to use? Sass (SCSS)     [ https://sass-lang.com/documentation/syntax#scss                ]
? Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? no
CREATE library_web/README.md (1071 bytes)
CREATE library_web/.editorconfig (274 bytes)
CREATE library_web/.gitignore (587 bytes)
CREATE library_web/angular.json (2784 bytes)
CREATE library_web/package.json (1043 bytes)
CREATE library_web/tsconfig.json (1012 bytes)
CREATE library_web/tsconfig.app.json (424 bytes)
CREATE library_web/tsconfig.spec.json (434 bytes)
CREATE library_web/.vscode/extensions.json (130 bytes)
CREATE library_web/.vscode/launch.json (470 bytes)
CREATE library_web/.vscode/tasks.json (938 bytes)
CREATE library_web/src/main.ts (250 bytes)
CREATE library_web/src/index.html (296 bytes)
CREATE library_web/src/styles.scss (80 bytes)
CREATE library_web/src/app/app.component.scss (0 bytes)
CREATE library_web/src/app/app.component.html (19903 bytes)
CREATE library_web/src/app/app.component.spec.ts (931 bytes)
CREATE library_web/src/app/app.component.ts (308 bytes)
CREATE library_web/src/app/app.config.ts (310 bytes)
CREATE library_web/src/app/app.routes.ts (77 bytes)
CREATE library_web/public/favicon.ico (15086 bytes)
✔ Packages installed successfully.
    Directory is already under version control. Skipping initialization of git.

Infine, puoi avviare il tuo web server di test direttamente dalla CLI di Angular.

# ng serve
Initial chunk files | Names         |  Raw size
polyfills.js        | polyfills     |  90.20 kB |
main.js             | main          |  22.64 kB |
styles.css          | styles        |  96 bytes |

                    | Initial total | 112.94 kB

Application bundle generation complete. [1.637 seconds]

Watch mode enabled. Watching for file changes...
NOTE: Raw file sizes do not reflect development server per-request transformations.
  ➜  Local:   http://localhost:4200/
  ➜  press h + enter to show help

Aprire il browser e andare al seguente URL: http://localhost:4200.

angular

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *