https://github.com/embarq/rently
https://github.com/embarq/rently
angular angular-ssr bootstrap firebase firebase-functions ssr
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/embarq/rently
- Owner: embarq
- Created: 2019-09-23T12:33:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T11:00:19.000Z (over 3 years ago)
- Last Synced: 2024-10-11T14:25:36.688Z (over 1 year ago)
- Topics: angular, angular-ssr, bootstrap, firebase, firebase-functions, ssr
- Language: TypeScript
- Homepage: https://dc-rently.web.app
- Size: 13 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rently [](https://circleci.com/gh/embarq/rently/tree/master)
## Development
- Clone the repo
- Install dependencies(npm recommended)
- Download runtime config via `npm run appconfig`
- Use one of the scripts from the list below
## Scripts
|Topic|Script|
|-----|------|
|General development|`serve`|
|Development SSR build|`build:all:dev`|
|Production SSR build|`build:all`|
|Interact with SSR|`firebase serve`|
|Download runtime config|`appconfig`|
## SSR development notes
- The SSR part was initially generated using Angular CLI as described in [official docs](https://angular.io/guide/universal)
- Since the project heavily depends on Firebase services(using AngularFire wrapper) we need to some fixes in regards building/packaging firebase sources:
- [`webpack.server.config.js`] Point out modules resolution order in `resolve.mainFields`
- [`webpack.server.config.js`] Modify `externals` - add `/^firebase/` entry since Firebase has some troubles being bundled when in the Node environment
- [`webpack.server.config.js`] Provide `output.libraryTarget` & `output.library` data because we want to run out SSR server in the Firebase function called `ssr`
- Move firebase web config into functions remote config. You can download remote config using `npm run appconfig`
- [`src/app/core/core.module.ts`] Replace generic `AngularFireModule.initializeApp({ })` with manual initialization of `FirebaseOptionsToken` with value from `environment`
- `server.ts` file generated by Angular CLI was enhanced with logging and some fixes:
- Add important pollyfils for firebase running in node
- Rewrite `Express.Request.originalUrl` from to absolute to relative path. Original url initially comes as `https://{firebase-project-id}/{page-route}`. We need to get rid of the first part for Angular Router to correctly resolve path within the frontend app navigation
- Instead of listening the SSR server it needs to be exported for cloud function to actually run it
## Development server
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.
## Code scaffolding
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`.
## Build
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.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).