This project was generated with Angular CLI version 1.4.5.
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.
-
Copy route-guard folder to app/ of client
-
Import AuthGuard to app.module.ts
import { AuthGuard } from './services/route-guards'providers: [ AuthGuard ],
-
Inside session.ts add these functions
verifySsoToken(payload: any){ let sign_in_url = "https://api.spsuite.co/api"; return this.http.post(`${sign_in_url}/sso/validate_token`, payload , true); }refreshSsoToken(){ let sign_in_url = "https://api.spsuite.co/api"; return this.http.get(`${sign_in_url}/sso/show`); } -
Import AuthGuard and add the guard to route
example: { path: 'company-events', component: CompanyEventsComponent, canActivate: [AuthGuard] , }, -
Add this code to the nginit of every component to remove parameters after authentication
``` this.activeRoute.queryParams.subscribe(routeParams => { if(routeParams.sso!=null){ this.location.replaceState(this.location.path().split("?")[0]) }}); } ```
-
Don't forget to add headers in request headerParams['AccessToken'] = currentUser.access_token; headerParams['UserId'] = currentUser.id; headerParams['UserEmail'] = currentUser.email;
use CLI generators to generate new components/services. use NG6 Starter for webpack configs. (easily plug pug,scss,hmr etc.)
npm run server:dev
(start server in dev mode)
* modify/add global css under /styles folder * manage import precedence on style.scss
* modify config/config.dev.json (for dev) or config.prod.json (for prod) * use var as APP_CONFIG['api_url'] (anywhere in the app, no need for extra imports)
create service under /services/api update index.ts update app.module.ts import the new service update APP_PROVIDERS (inside app.module.ts)
(same method on almost any other @Injectable) models do not need to be injected in app.module.ts because they are not @Injectable
example:
ng g component pages/admin/users
this will automaticable inject the new component inside admin.module.ts modify .angular-cli for other options
almost all apps use these utils; please inform @rav or @mark or @rodm if there are any bugs or modification suggestions on these utils
run
./staging
or
./production
modify deploy/staging.rb for configs
docker-compose up
* This kit auto installs polyfills for edge and IE. You might need to uninstall these if you want to install other webpack related pollyfills.
for more options pls visit