This project was generated with Angular CLI version 7.3.7.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app 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. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
This project is using the redux patern to cominuicate with external APIs and managing the application store implementing NgRx library folliwing the NgRx - Best Practices for Enterprice Angular Applications guide refered from the Official NgRx library documentation.
User authentication is handled following this guide.
Check out the blog post.
- Fork/Clone
- Install dependencies -
npm install
- Run the development server -
ng serve
You will need to also spin up a back-end with the following routes:
URL | HTTP Verb | Action |
---|---|---|
http://localhost:1337/register | POST | Register a new user |
http://localhost:1337/login | POST | Log a user in |
http://localhost:1337/status | GET | Get user status |
The blog post uses a fake back-end that generates a dummy token to test out the functionality on the front-end. If you'd like to use it, clone down the repo in a new terminal window, install the dependencies, and fire up the app:
$ git clone https://github.com/testdrivenio/fake-token-api
$ cd fake-token-api
$ npm install
$ npm start
Just keep in mind that the back-end does not create a real JSON Web Token (JWT). Feel free to swap it out for a working back-end or use the final application from the Token-Based Authentication with Node blog post, if you'd like.