You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nicolas Garnier
3af6b1e25a
|
8 years ago | |
---|---|---|
.. | ||
functions | 8 years ago | |
public | 8 years ago | |
README.md | 8 years ago | |
firebase.json | 8 years ago |
README.md
Server-side generated pages w/ Handlebars templating and user sessions
This samples shows how to serve server-side generated HTML pages using the HandlebarsJs templating system.
It also shows how to serve user specific content by passing the Firebase ID token of the signed-in user in a __session
cookie.
Checking and decoding the ID token passed in the __session
cookie is done with an ExpressJs middleware.
Some custom scripts in [functions/views/layouts/main.handlebars] maintain the Firebase ID token in the __session
cookie.
Setting up the sample
- Create a Firebase Project using the Firebase Console.
- Enable the Google Provider in the Auth section.
- Clone or download this repo and open the
template-handlebars
directory. - You must have the Firebase CLI installed. If you don't have it install it with
npm install -g firebase-tools
and then configure it withfirebase login
. - Configure the CLI locally by using
firebase use --add
and select your project in the list. - Install dependencies locally by running:
cd functions; npm install; cd -
Deploy and test
This sample comes with a web-based UI for testing the function. To test it out:
- Deploy your project using
firebase deploy
- Open the app using
firebase open hosting:site
, this will open a browser. - Sign in the web app in the browser using Google Sign-In and some user information will be displayed on a server-side generated page.
Contributing
We'd love that you contribute to the project. Before doing so please read our Contributor guide.
License
© Google, 2017. Licensed under an Apache-2 license.