This project was generated with Angular CLI version 18.0.7.
Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.
Run ng build to build the project. The build artifacts will be stored in the dist/ directory.
Run ng test to execute the unit tests via Karma.
Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.
This project is a web application based on Angular that allows users to register, log in, and explore a list of starships from the Star Wars universe. The application includes an authentication and authorization system using JSON Server and JSON Server Auth to manage users. Only registered and logged-in users can access the list of starships and the details of each one.
- User Registration: Users can register with a unique email. The system validates that no users have the same email.
- User Login: Users can log in with their registered credentials.
- Route Protection: Only logged-in users can access the starships list and the details of each starship.
- Redirection: If an unauthenticated user tries to access a protected route, they will be redirected to the login page.
This project provides a solid foundation for a Star Wars starship management application, ensuring that only authenticated users can access the critical functionalities of the application.
-
Project Structure:
- Initial setup of the Angular project.
- Creation of basic components for the application.
-
Routing:
- Configuration of main routes (Home, Login, Register, Starships).
-
User Interface:
- Design of the user interface with CSS and Bootstrap.
- Implementation of a responsive design.
-
Registration Form:
- Creation of the registration form.
- Frontend data validation.
-
Login Form:
- Creation of the login form.
- Frontend data validation.
-
Integration with JSON Server:
- Configuration of JSON Server to simulate a REST API.
- Creation of the
db.jsonfile to store users.
-
Authentication and Authorization:
- Implementation of JSON Server Auth for authentication with JWT.
- Route protection so that only logged-in users can access certain pages(Starships & Starships Details).
- Redirection to login if an unauthenticated user tries to access protected content.
- Angular: Main framework for the development of the application.
- Bootstrap: CSS framework for responsive design.
- JSON Server: Simulates a REST API to manage data.
- JSON Server Auth: Extension to manage authentication and authorization with JSON Web Tokens (JWT).
- Node.js and npm installed on your machine.
-
Clone the project repository:
git clone https://github.com/your_username/your_repository.git cd your_repository -
Install project dependencies:
npm install
-
Install JSON Server and JSON Server Auth:
npm install -D json-server@0.17.4 json-server-auth
-
Create the db.json file in the root of the project with the following content::
{ "users": [] } -
Start the backend with JSON Server Auth:
npx json-server-auth db.json
-
Start the Angular application:
ng serve