0.2.0 • Published 5 years ago

@digitalus/platform v0.2.0

Weekly downloads
5
License
-
Repository
-
Last release
5 years ago

DigPlatform

The DigPlatform module handles low level integration with the Firebase (Google Cloud) resources and application state.

Installation

Dig Platform requires Firebase for its back end, so the first step is installing their SDK and configuring the project.

Setup Firebase

If you don't have a Firebase account set one up: https://firebase.google.com/.

# install Firebase tools
npm install -g firebase-tools

# connect to your firebase account
firebase login

# initialize the project
cd path/to/project/root
firebase init
  1. You will be prompted to select the services that you are going to use. Enable Firestore, Functions, Hosting, and Storage.
  2. Next you will be prompted to select the default Firebase project. You can create a new project or connect to an existing project if you already have one.
  3. Once this is done you will be prompted to configure Firebase
  • we use the default values for all files (like the Firestore rules file for example)
  • set your public directory to dist
  • configure your app as a single-page app

Add DigPlatform to your project

Once you have configured Firebase you need to add DigPlatform to your project:

npm i @digitalus/platform

Go to your project on the Firebase console and get the configuration from project settings. Add the DigPlatform configuration to your environment/environment... files:

// src/environments/environment.ts
export const environment = {
  // add this section
  digPlatform: {
    firebase: {
      apiKey: "#################",
      authDomain: "#################",
      databaseURL: "#################",
      projectId: "#################",
      storageBucket: "#################",
      messagingSenderId: "#################",
      appId: "#################",
      measurementId: "#################",
    }
  }
  // more environmental settings
};

Note that Google handles security on the server level, so these keys (by design) are not private and can be included in source code

Finally add the DigPlatform module to your application:

// src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {DigPlatformModule} from '@digitalus/platform';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    DigPlatformModule.forRoot(environment.digPlatform),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
0.2.0

5 years ago

0.1.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago