The Objective of this application is to understand Angular Forms, Authentication & Security, Routing & Guards
- Fork this boilerplate repository
- Clone the boilerplate repository and cd into it
- Install dependencies
npm install
- Run the backend
npm run serve
which shall run on port:3000 - Run the frontend
npm run start
which shall run on port:4200
On running npm run serve
, following apis would be available for your use -
- To authenticate user - POST - http://localhost:3000/auth/v1 - expecting data - { username, password }
- To check if user is authenticated - POST - http://localhost:3000/auth/v1/isAuthenticated - expecting header - { 'Authorization',
Bearer ${token}
} - To get notes - GET - http://localhost:3000/api/v1/notes - expecting header - { 'Authorization',
Bearer ${token}
} - To add a note - POST - http://localhost:3000/api/v1/notes - expecting header - { 'Authorization',
Bearer ${token}
} and data - { note }
- Keep should use Material Design for it's UI
- User shall be shown a login form
- After authentication, user is able to see all the notes on the page loaded from server as Cards
- User is be able to create and persist notes on server
- You are expected to use
Note
class for Note model AppModule
shall be the root module- Application to have two routes -
a.dashboard
mapped toDashboardComponent
b.login
mapped toLoginComponent
dashboard
being the default route AppComponent
as the bootstrapping component - which displays theHeaderComponent
and one other component based on the requested routeHeaderComponent
to use Material Toolbar with text contentKeep
LoginComponent
6.1. is expected to use Angular Reactive Forms with two form controlsusername
andpassword
with classesusername
andpassword
respectively and a button with textSubmit
to submit the form
6.2. is expected to have an element with class nameerror-message
to display any server error messages
6.3. to have aloginSubmit()
method called when form is submitted which shall validate the user credentials with server, if validation is successful, user is redirected todashboard
and his token is saved in local storageDashboardComponent
to contain the same Expansion Panel and the Notes Collection fromAppComponent
implemented inKeep Level 1
CanActivateRouteGuard
to protect dashboard route, redirect unauthenticated users to login route and return the authenticated status as true or false for the user fromcanActivate
methodAuthenticationService
talks to the server for user authentication and shall include methods -
9.1authenticateUser()
to get the user authenticated - accepts { username, password } and returns server response
9.2setBearerToken()
to save user token in local storage with keybearerToken
- accepts the token string
9.3getBearerToken()
to fetch user token from local storage
9.4isUserAuthenticated()
to validate authenticity of a user - accepts the token string and returns Promise of authenticated status of userNotesService
talks to the server to fetch/persist data and shall include methods -
10.1getNotes()
to fetch the notes collection
10.2addNote()
to persist a note to serverRouterService
to navigate user to available routes -
11.1routeToDashboard()
to navigate to dashboard route
11.2routeToLogin()
to navigate to login route- Ensure following commands succeed in your local machine before submitting your code for Preliminary automated review as described next -
npm install npm run build npm run lint
- Ensure unit test cases pass -
npm run test
- Ensure e2e test cases pass -
npm run serve
(backend shall be running before executing e2e test cases)
npm run e2e
- Open
https://hobbes-cts.stackroute.in/#/
and login into the platform - Under
Assignment repository
selectangular-keep-level-2-assignment
, and branchmaster
- Under
Your solution repository
select your own repository and branch - Press
Submit
- Press
click here
for the feedback - Evaluation will take around 5 mins to complete after which you need to refresh your browser and get the updated status
- Watch out for your total score and detailed status on each test and eslint errors in the coloured blocks on the screen
- Fix failing test cases as well as eslint errors and re-submit your solution (you may skip any eslint errors reported in the provided spec files)
-
You add the respective Mentor as a Reporter/Master into your Assignment Repository
-
You have checked your Assignment on the Automated Evaluation Tool - Hobbes (Check for necessary steps in your Boilerplate - README.md file. ) and got the required score - Check with your mentor about the Score you must achieve before it is accepted for Manual Submission.
-
Intimate your Mentor on Slack and/or Send an Email to [email protected] - with your Git URL - Once you are done working and are ready for final submission.