Creación de Proyectos
Creación de Proyectos
1. Instalar Node JS
2. Activar la ejecución de scripts
Abrimos power Shell como administrador
Verificamos la ejecución de scripts con
Get- ExecutionPolicy
Si aparece Restricted, debemos cambiarlos a unrestricted con el comando
Set-ExecutionPolicy Unrestricted
3. Instalar vsCode
4. Abrir una carpeta en VSCODE, abrir una terminar y actualizar npm
npm install -g npm-windows-upgrade
5. Instalamos la interfaz de línea de comandos de Angular
npm install -g @angular/cli
6. Creamos el proyecto con
ng new app (app es el nombre del proyecto usar al gusto)
Which stylesheet format would you like to use? CSS
Do you want to enable Server-Side Rendering (SSR) and Static Site Generation
(SSG/Prerendering)? No
7. Ingresamos a la carpeta
cd app
8. Iniciamos nuestro servidor y en un navegador ponemos http://localhost:4200/
ng serve
9. Abrimos el archivo app.component.html
<router-outlet />
10. Creamos la ventana de login
ng g c auth/login
11. Direccionamos la aplicación por defecto al componente login, para ello abrimos el
archivo app.routes.ts
export const routes: Routes = [
{path:'login', component:LoginComponent},
{path:'', redirectTo:'login', pathMatch:'full'}
];
<mat-card class="form-container">
<mat-card-header>
<mat-card-title>Iniciar Sesión</mat-card-title>
</mat-card-header>
<mat-card-content class="cont">
<form>
<mat-form-field appearance="fill" class="caja">
<mat-label>Correo</mat-label>
<input matInput formControlName="email" required>
</mat-form-field>
<mat-form-field appearance="fill" class="caja">
<mat-label>Contraseña</mat-label>
<input matInput type="password" formControlName="password" required>
</mat-form-field>
<button mat-raised-button color="primary" type="submit"
class="boton">Iniciar sesión</button>
</form>
<p>¿No tiene una cuenta? <a>Regístrese</a></p>
</mat-card-content>
</mat-card>
</div>
<footer class="footer">
<p>© 2024 Todos los derechos reservados.</p>
<p>Talavera - Andahuaylas - Perú.</p>
</footer>
</div>
</body>
.content {
display: flex;
flex-direction: column;
min-height: 100vh; /* Ensures the content stretches to at least full viewport height
*/
}
.login-container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin-top: 50px; /* Adjust margin as needed */
flex: 1; /* Takes remaining vertical space */
}
.logo {
display: block;
margin: 0 auto;
max-width: 200px;
max-height: 200px;
}
mat-card {
width: 90%; /* Responsive width */
max-width: 400px; /* Maximum width */
margin-top: 20px; /* Adjust spacing */
}
.sub-title {
font-weight: bold;
color: white;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
text-align: center;
margin: 1px 0;
}
.footer {
text-align: center;
padding: 10px;
background-color: rgb(23, 102, 249);
color: #ffffff;
}
.caja{
width: 100%;
font-size: 14px;
height: 70px;
.caja mat-label{
font-size: 14px;
}
.boton{
width: 100%;
margin-bottom: 20px;
}
17. Instamos la línea de comandos de firebase
npm install firebase
18. Instalamos las herramientas de Firebase
npm install firebase-tools
19. Agregamos firebase a nuestro proyecto
Si deseas cambiar de cuenta de Gmail para tu proyecto firebase debes
Cerrar sesión: firebase logout
ng add @angular/fire
The package @angular/fire@17.1.0 will be installed and executed.
Would you like to proceed? Yes
Allow Firebase to collect CLI and Emulator Suite usage and error reporting
information? (Y/n) n
firebase init
? Are you ready to proceed? (Y/n) y
Seleccionamos hosting
? Which Firebase features do you want to set up for this directory? Press Space to
select features, then Enter to confirm your
choices. (Press <space> to select, <a> to toggle all, <i> to invert selection, and
<enter> to proceed)
( ) Realtime Database: Configure a security rules file for Realtime Database and
(optionally) provision default instance
( ) Firestore: Configure security rules and indexes files for Firestore
( ) Functions: Configure a Cloud Functions directory and its files
>(*) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub
Action deploys
( ) Hosting: Set up GitHub Action deploys
( ) Storage: Configure a security rules file for Cloud Storage
( ) Emulators: Set up local emulators for Firebase products
? Detected an existing Angular codebase in the current directory, should we use this?
(Y/n) n
Con ello se configura el archivo firebase.json, debemos modificar en que site se va subir
y guardamos el archivo:
{
"hosting": {
"site": "sigpe-solaris",
"public": "dist/app/browser",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}