Skip to content

Instantly share code, notes, and snippets.

View wataruoguchi's full-sized avatar
🦥
Curiosity Driven

Wataru Oguchi wataruoguchi

🦥
Curiosity Driven
View GitHub Profile
$ # make sure you're in functions directory
$ # move to <proj> directory
$ cd ../
$ firebase init hosting
$ # all answers should be default
- ? What do you want to use as your public directory?
- ? Configure as a single-page app (rewrite all urls to /index.html)?
const functions = require('firebase-functions')
const express = require('express')
const { Nuxt } = require('nuxt')
const app = express()
const config = {
dev: false,
buildDir: 'nuxt',
build: {
$ # make sure you're in functions directory
$ echo '' > index.js && vi index.js
$ # add the packages
$ yarn
$ # install express
$ yarn add express
$ # move to src directory, build the app and go back to functions directory
$ cd ../src/ && yarn build && cd ../functions/
$ # move to functons directory
$ cd functions
$ # edit the file
$ vi package.json
$ # move to <proj> directory
$ cd <proj>
$ # install firebase-tools
$ sudo npm i -g firebase-tools
$ # login
$ firebase login
$ # initialize Cloud Functions
$ firebase init functions
$ # [create a new project]
- ? Select a default Firebase project for this directory: