Fireship · @fireship

Angular 4 Development and Production Environments with Firebase

Uploaded April 7, 2017 · Length 1:50

Angular 4 Development and Production Environments with Firebase

Summary

create separate dev and prod environments with angular and firebase

  • angular firebase
  • angular development environment
  • angular production environment
  • firebase configuration
  • angular firebase setup

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    welcome to angular firebase today I'm

  2. 0:02

    going to show you how to create separate

  3. 0:04

    back-end environments for development

  4. 0:06

    and production with angular for

  5. 0:08

    maintaining separate environments allows

  6. 0:10

    you to build and test new features

  7. 0:12

    without screwing up data from your live

  8. 0:14

    production app step one create two fire

  9. 0:17

    based projects before jumping into the

  10. 0:19

    code you'll need two separate projects

  11. 0:21

    on fire firebase one for development and

  12. 0:23

    one for production step 2 create the

  13. 0:26

    environment files in this case I have

  14. 0:29

    cloned the fire starter app from github

  15. 0:30

    and the first step is to create the

  16. 0:33

    environment file files manually if you

  17. 0:35

    create a new app with the angular CLI

  18. 0:37

    then these files are going to be here by

  19. 0:40

    default and then also make sure to add

  20. 0:42

    these files to your git ignore because

  21. 0:44

    they hold sensitive credentials and you

  22. 0:46

    don't want that ending up in a public

  23. 0:48

    repo step 3

  24. 0:51

    paste in the firebase configuration into

  25. 0:54

    each of the environment files step 4

  26. 1:00

    bootstrap the environment in the app

  27. 1:02

    module now we can import the environment

  28. 1:05

    variables anywhere in our app in this

  29. 1:07

    case we want to bootstrap the firebase

  30. 1:09

    configuration directly in the app module

  31. 1:12

    the code you're looking at right now is

  32. 1:14

    what is specifically needed to wire up

  33. 1:16

    angular firebase with these separate

  34. 1:18

    environments in your app module

  35. 1:22

    step 5 serve or compile the app with

  36. 1:26

    that done it's possible to serve the app

  37. 1:27

    locally using either environment all we

  38. 1:30

    have to do is add the prod to ng serve

  39. 1:33

    and that'll serve the app in production

  40. 1:36

    thanks for watching I'll see you on the

  41. 1:38

    other side

  42. 1:42

    [Music]

  43. 1:45

    you