├── .gitignore ├── .setup-firebaserc ├── CHANGELOG.md ├── README.md ├── firebase.json ├── package-lock.json ├── package.json ├── public └── assets │ └── .gitkeep └── src ├── .babelrc ├── .editorconfig ├── .gitignore ├── README.md ├── assets └── README.md ├── components ├── Logo.vue └── README.md ├── index.js ├── jest.config.js ├── layouts ├── README.md └── default.vue ├── middleware └── README.md ├── nuxt.config.js ├── package-lock.json ├── package.json ├── pages ├── README.md ├── about.vue └── index.vue ├── plugins └── README.md ├── server └── index.js ├── static ├── README.md ├── favicon.ico └── icon.png ├── store └── README.md └── test └── Logo.spec.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /node_modules/ 3 | /src/node_modules/ 4 | /functions/node_modules/ 5 | /functions/.nuxt/ 6 | # env files 7 | .env 8 | .env.local 9 | .env.*.local 10 | 11 | # Log files 12 | npm-debug.log* 13 | yarn-debug.log* 14 | yarn-error.log* 15 | firebase-debug.log 16 | 17 | # Editor directories and files 18 | .idea 19 | *.iml 20 | .vscode 21 | *.suo 22 | *.ntvs* 23 | *.njsproj 24 | *.sln 25 | 26 | # Testing 27 | /src/test/unit/coverage/ 28 | /src/test/e2e/reports/ 29 | selenium-debug.log 30 | 31 | # Nuxt build 32 | .nuxt/ 33 | dist/ 34 | 35 | # Public folder 36 | /public/ 37 | 38 | # Firebase 39 | .firebase 40 | .firebaserc -------------------------------------------------------------------------------- /.setup-firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "YOUR_FIREBASE_PROJECT_ID", 4 | "develop": "YOUR_FIREBASE_PROJECT_ID", 5 | "staging": "YOUR_FIREBASE_PROJECT_ID", 6 | "production": "YOUR_FIREBASE_PROJECT_ID" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | # 2.0.1 3 | 4 | ### change (2020-10-06) 5 | 6 | * engine downgrade 10 to 8 ( untill Feb 15, 2021 ) for free version [Ref](https://firebase.google.com/support/faq#expandable-10) 7 | * Vue packages version mismatch in ssr 8 | 9 | ``` 10 | + nuxt@2.14.6 11 | added 207 packages from 156 contributors, removed 135 packages, updated 294 packages, moved 13 packages and audited 2481 packages in 66.796s 12 | 13 | Vue packages version mismatch: 14 | 15 | - vue@2.6.11 16 | - vue-server-renderer@2.6.12 17 | 18 | ``` 19 | 20 | # 2.0.0 21 | 22 | ### :rocket: changes (2020-04-24) 23 | 24 | * update @nuxtjs/vuetify to **1.11.0** 25 | * move nuxt to version **2.12.2** 26 | 27 | ``` 28 | + nuxt@2.12.2 29 | added 414 packages from 92 contributors, removed 36 packages, updated 224 packages and moved 13 packages in 125.417s 30 | fixed 38378 of 38683 vulnerabilities in 898385 scanned packages 31 | 32 | Dev dependencies 33 | + babel-jest@25.4.0 34 | + jest@25.4.0 35 | + nodemon@2.0.3 36 | ``` 37 | 38 | 39 | ### :boom: Breaking changes (2019-09-04) 40 | 41 | * decrease **size** cloud function 42 | * move to node **v.10** 43 | * clear functions folder and move 1 folder only 44 | * move nuxt to version **2.9.2** -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt2.js Universal App with SSR via Firebase Functions and Firebase Hosting 2 | 3 | Host a Nuxt2 Universal app or site by combining Nuxt2.js with Firebase Cloud Functions and Hosting. 4 | 5 | [Live Preview](https://fir-nuxt-vuetify-demo.web.app/) 6 | 7 | --- 8 | 9 | ## Pre-Setup: Before Installing Any Dependencies 10 | 11 | 1. Obtain a Firebase Project ID to use for this project. [See Overiew Here](#firebase-project-setup) 12 | 13 | 2. Inside this directory, locate the file `.setup-firebaserc` and replace the text `YOUR_FIREBASE_PROJECT_ID` with your Firebase Project ID. 14 | 15 | --- 16 | 17 | ## Setup 18 | 19 | We will now get everything setup and deployed in 3 commands: 20 | 21 | **Note:** _All of these commands are ran from the root directory_ 22 | 23 | 1. Install Dependencies in all necessary directories and creates `.firebaserc` from `.setup-firebaserc` 24 | 2. `npm install -g firebase-tools` 25 | 26 | ```bash 27 | yarn setup 28 | ``` 29 | 30 | ### for Dev 31 | 32 | ```bash 33 | yarn dev 34 | ``` 35 | 36 | ### for Serve (Local server) 37 | 38 | ```bash 39 | yarn firebase:serve 40 | ``` 41 | 42 | ### for deploy (Firebase hosting) 43 | 44 | ```bash 45 | yarn deploy 46 | ``` 47 | 48 | --- 49 | 50 | ### Firebase Project Setup 51 | 52 | 1. Create a Firebase Project using the [Firebase Console](https://console.firebase.google.com). 53 | 54 | 2. Obtain the Firebase Project ID 55 | 56 | ### Features 57 | 58 | - Server-side rendering with Firebase Hosting combined with Firebase Functions 59 | - Firebase Hosting as our CDN for our publicPath (See nuxt.config.js) 60 | 61 | ### Things to know... 62 | 63 | - 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 with `firebase login`. 64 | 65 | - If you have errors, make sure `firebase-tools` is up to date. I've experienced many problems that were resolved once I updated. 66 | 67 | * The root directory has a package.json file with several scripts that will be used to optimize and ease getting started and the workflow 68 | 69 | * ALL commands are ran from the root directory 70 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "public", 4 | "rewrites": [ 5 | { 6 | "source": "**", 7 | "function": "nuxtvuetify" 8 | } 9 | ] 10 | }, 11 | "functions": { 12 | "source": "src", 13 | "predeploy": "yarn build && yarn pre:deploy", 14 | "ignore":[ 15 | "static", 16 | "node_modules", 17 | "**/**/dist/client" 18 | ] 19 | } 20 | } -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt2-firebase-ssr", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "cross-env": { 8 | "version": "5.2.1", 9 | "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.2.1.tgz", 10 | "integrity": "sha512-1yHhtcfAd1r4nwQgknowuUNfIT9E8dOMMspC36g45dN+iD1blloi7xp8X/xAIDnjHWyt1uQ8PHk2fkNaym7soQ==", 11 | "dev": true, 12 | "requires": { 13 | "cross-spawn": "^6.0.5" 14 | } 15 | }, 16 | "cross-spawn": { 17 | "version": "6.0.5", 18 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", 19 | "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", 20 | "dev": true, 21 | "requires": { 22 | "nice-try": "^1.0.4", 23 | "path-key": "^2.0.1", 24 | "semver": "^5.5.0", 25 | "shebang-command": "^1.2.0", 26 | "which": "^1.2.9" 27 | } 28 | }, 29 | "isexe": { 30 | "version": "2.0.0", 31 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 32 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 33 | "dev": true 34 | }, 35 | "nice-try": { 36 | "version": "1.0.5", 37 | "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", 38 | "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", 39 | "dev": true 40 | }, 41 | "path-key": { 42 | "version": "2.0.1", 43 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", 44 | "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", 45 | "dev": true 46 | }, 47 | "semver": { 48 | "version": "5.7.1", 49 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 50 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", 51 | "dev": true 52 | }, 53 | "shebang-command": { 54 | "version": "1.2.0", 55 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 56 | "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 57 | "dev": true, 58 | "requires": { 59 | "shebang-regex": "^1.0.0" 60 | } 61 | }, 62 | "shebang-regex": { 63 | "version": "1.0.0", 64 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 65 | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", 66 | "dev": true 67 | }, 68 | "which": { 69 | "version": "1.3.1", 70 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", 71 | "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", 72 | "dev": true, 73 | "requires": { 74 | "isexe": "^2.0.0" 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt2-firebase-ssr", 3 | "version": "2.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "setup:client": "cd \"src\" && npm i", 8 | "setup:firebase": "cp .setup-firebaserc .firebaserc", 9 | "setup": "npm i && npm run setup:firebase && npm run setup:client", 10 | "dev": "cd ./src && npm run dev", 11 | "build": "cd ./src && npm run build", 12 | "copyassets": "cp -R ./src/.nuxt/dist/client/* ./public/assets", 13 | "copystatic": "cp -R ./src/static/* ./public", 14 | "pre:deploy": "npm run copyassets && npm run copystatic", 15 | "firebase:serve": "npm run build && npm run serve", 16 | "serve": "cross-env DEBUG=nuxt:* firebase serve --only hosting,functions", 17 | "deploy": "firebase deploy" 18 | }, 19 | "keywords": [], 20 | "author": "", 21 | "license": "ISC", 22 | "devDependencies": { 23 | "cross-env": "^5.2.1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /public/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/winzaa123/nuxt2-vuetify-ssr-on-firebase/9fa6dc21acabedacb7f503930940b8db85f20a6e/public/assets/.gitkeep -------------------------------------------------------------------------------- /src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "test": { 4 | "presets": [ 5 | [ 6 | "@babel/preset-env", 7 | { 8 | "targets": { 9 | "node": "current" 10 | } 11 | } 12 | ] 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (https://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | node_modules/ 39 | jspm_packages/ 40 | 41 | # TypeScript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | 62 | # parcel-bundler cache (https://parceljs.org/) 63 | .cache 64 | 65 | # next.js build output 66 | .next 67 | 68 | # nuxt.js build output 69 | .nuxt 70 | 71 | # Nuxt generate 72 | dist 73 | 74 | # vuepress build output 75 | .vuepress/dist 76 | 77 | # Serverless directories 78 | .serverless 79 | 80 | # IDE 81 | .idea 82 | 83 | # Service worker 84 | sw.* 85 | -------------------------------------------------------------------------------- /src/README.md: -------------------------------------------------------------------------------- 1 | # nuxt2-firebase-ssr 2 | 3 | > My polished Nuxt.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | $ yarn install 10 | 11 | # serve with hot reload at localhost:3000 12 | $ yarn run dev 13 | 14 | # build for production and launch server 15 | $ yarn run build 16 | $ yarn start 17 | 18 | # generate static project 19 | $ yarn run generate 20 | ``` 21 | 22 | For detailed explanation on how things work, checkout [Nuxt.js docs](https://nuxtjs.org). 23 | -------------------------------------------------------------------------------- /src/assets/README.md: -------------------------------------------------------------------------------- 1 | # ASSETS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). 8 | -------------------------------------------------------------------------------- /src/components/Logo.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 80 | -------------------------------------------------------------------------------- /src/components/README.md: -------------------------------------------------------------------------------- 1 | # COMPONENTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | The components directory contains your Vue.js Components. 6 | 7 | _Nuxt.js doesn't supercharge these components._ 8 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const functions = require("firebase-functions"); 2 | const { Nuxt } = require("nuxt"); 3 | const express = require("express"); 4 | const app = express(); 5 | 6 | 7 | const config = { 8 | dev: false, 9 | buildDir: ".nuxt", 10 | build: { 11 | publicPath: "/assets/" 12 | } 13 | }; 14 | const nuxt = new Nuxt(config); 15 | 16 | exports.nuxtvuetify = functions.https.onRequest(async (req, res) => { 17 | 18 | if (config.dev) { 19 | const builder = new Builder(nuxt) 20 | await builder.build() 21 | } else { 22 | res.set("Cache-Control", "public, max-age=300, s-maxage=600"); 23 | await nuxt.ready() 24 | } 25 | app.use(nuxt.render) 26 | // app.use(handleRequest); 27 | // Give nuxt middleware to express 28 | return app(req, res); 29 | }); 30 | -------------------------------------------------------------------------------- /src/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleNameMapper: { 3 | '^@/(.*)$': '/$1', 4 | '^~/(.*)$': '/$1', 5 | '^vue$': 'vue/dist/vue.common.js' 6 | }, 7 | moduleFileExtensions: ['js', 'vue', 'json'], 8 | transform: { 9 | '^.+\\.js$': 'babel-jest', 10 | '.*\\.(vue)$': 'vue-jest', 11 | }, 12 | "collectCoverage": true, 13 | "collectCoverageFrom": [ 14 | "/components/**/*.vue", 15 | "/pages/**/*.vue" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /src/layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Application Layouts. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). 8 | -------------------------------------------------------------------------------- /src/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 82 | 83 | 102 | -------------------------------------------------------------------------------- /src/middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your application middleware. 6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages. 7 | 8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). 9 | -------------------------------------------------------------------------------- /src/nuxt.config.js: -------------------------------------------------------------------------------- 1 | const pkg = require('./package') 2 | 3 | 4 | module.exports = { 5 | // mode: 'universal', ssr : true (Default) ;; ssr: false // for SPA 6 | 7 | /* 8 | ** Headers of the page 9 | */ 10 | head: { 11 | title: pkg.name, 12 | meta: [ 13 | { charset: 'utf-8' }, 14 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 15 | { hid: 'description', name: 'description', content: pkg.description } 16 | ], 17 | link: [ 18 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, 19 | { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' } 20 | ] 21 | }, 22 | 23 | /* 24 | ** Customize the progress-bar color 25 | */ 26 | loading: { color: '#fff' }, 27 | 28 | /* 29 | ** Global CSS 30 | */ 31 | css: [ 32 | // 'ant-design-vue/dist/antd.css' 33 | ], 34 | 35 | /* 36 | ** Plugins to load before mounting the App 37 | */ 38 | plugins: [ 39 | // { src: '@/plugins/antd-ui', mode: 'server' } 40 | ], 41 | 42 | /* 43 | ** Nuxt.js modules 44 | */ 45 | buildModules: [ 46 | '@nuxtjs/vuetify' 47 | ], 48 | modules: [ 49 | // Doc: https://axios.nuxtjs.org/usage 50 | '@nuxtjs/axios', 51 | '@nuxtjs/pwa', 52 | ], 53 | vuetify: { 54 | materialIcons: false, 55 | theme: { 56 | dark: false, 57 | default: 'white', 58 | primary: '#03A9F4', 59 | secondary: '#009688', 60 | accent: '#E91E63', 61 | error: '#f44336', 62 | warning: '#FDD835', 63 | info: '#2196f3', 64 | success: '#4caf50' 65 | } 66 | }, 67 | /* 68 | ** Axios module configuration 69 | */ 70 | axios: { 71 | // See https://github.com/nuxt-community/axios-module#options 72 | }, 73 | 74 | /* 75 | ** Build configuration 76 | */ 77 | buildDir: '.nuxt', 78 | build: { 79 | publicPath: '/assets/', 80 | 81 | babel: { 82 | presets({ isServer }) { 83 | // let targets = isServer ? { node: '10' } : { ie: '11' } 84 | return [ 85 | [ require.resolve('@nuxt/babel-preset-app'), 86 | { 87 | // targets 88 | buildTarget: isServer ? 'server' : 'client', 89 | corejs: { version: 3 } 90 | } 91 | ] 92 | ] 93 | }, 94 | 'env': { 95 | 'production': { 96 | 'plugins': [] 97 | } 98 | } 99 | }, 100 | /* 101 | ** You can extend webpack config here 102 | */ 103 | extend(config, ctx) { 104 | 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt2-firebase-ssr", 3 | "version": "1.0.0", 4 | "description": "My polished Nuxt.js project", 5 | "author": "win", 6 | "private": true, 7 | "scripts": { 8 | "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", 9 | "build": "nuxt build", 10 | "start": "cross-env NODE_ENV=production node server/index.js", 11 | "generate": "nuxt generate", 12 | "test": "jest" 13 | }, 14 | "engines": { 15 | "node": "8" 16 | }, 17 | "dependencies": { 18 | "@nuxtjs/axios": "^5.3.6", 19 | "@nuxtjs/pwa": "^2.6.0", 20 | "@nuxtjs/vuetify": "^1.11.0", 21 | "express": "^4.16.4", 22 | "firebase-admin": "^8.13.0", 23 | "firebase-functions": "^3.2.0", 24 | "node-fetch": "^2.6.1", 25 | "nuxt": "^2.14.6" 26 | }, 27 | "devDependencies": { 28 | "@babel/runtime-corejs3": "^7.5.5", 29 | "@vue/test-utils": "^1.0.0-beta.27", 30 | "babel-jest": "^25.4.0", 31 | "core-js": "^3.2.1", 32 | "cross-env": "^5.2.1", 33 | "jest": "^25.4.0", 34 | "nodemon": "^2.0.3", 35 | "vue-jest": "^4.0.0-rc.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/pages/README.md: -------------------------------------------------------------------------------- 1 | # PAGES 2 | 3 | This directory contains your Application Views and Routes. 4 | The framework reads all the `*.vue` files inside this directory and creates the router of your application. 5 | 6 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing). 7 | -------------------------------------------------------------------------------- /src/pages/about.vue: -------------------------------------------------------------------------------- 1 | 52 | -------------------------------------------------------------------------------- /src/pages/index.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 37 | 38 | 70 | -------------------------------------------------------------------------------- /src/plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). 8 | -------------------------------------------------------------------------------- /src/server/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const consola = require('consola') 3 | const { Nuxt, Builder } = require('nuxt') 4 | const app = express() 5 | 6 | // Import and Set Nuxt.js options 7 | let config = require('../nuxt.config.js') 8 | config.dev = !(process.env.NODE_ENV === 'production') 9 | 10 | async function start() { 11 | // Init Nuxt.js 12 | const nuxt = new Nuxt(config) 13 | 14 | const { host, port } = nuxt.options.server 15 | 16 | // Build only in dev mode 17 | if (config.dev) { 18 | const builder = new Builder(nuxt) 19 | await builder.build() 20 | } else { 21 | await nuxt.ready() 22 | } 23 | 24 | // Give nuxt middleware to express 25 | app.use(nuxt.render) 26 | 27 | // Listen the server 28 | app.listen(port, host) 29 | consola.ready({ 30 | message: `Server listening on http://${host}:${port}`, 31 | badge: true 32 | }) 33 | } 34 | start() 35 | -------------------------------------------------------------------------------- /src/static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your static files. 6 | Each file inside this directory is mapped to `/`. 7 | Thus you'd want to delete this README.md before deploying to production. 8 | 9 | Example: `/static/robots.txt` is mapped as `/robots.txt`. 10 | 11 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). 12 | -------------------------------------------------------------------------------- /src/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/winzaa123/nuxt2-vuetify-ssr-on-firebase/9fa6dc21acabedacb7f503930940b8db85f20a6e/src/static/favicon.ico -------------------------------------------------------------------------------- /src/static/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/winzaa123/nuxt2-vuetify-ssr-on-firebase/9fa6dc21acabedacb7f503930940b8db85f20a6e/src/static/icon.png -------------------------------------------------------------------------------- /src/store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Vuex Store files. 6 | Vuex Store option is implemented in the Nuxt.js framework. 7 | 8 | Creating a file in this directory automatically activates the option in the framework. 9 | 10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). 11 | -------------------------------------------------------------------------------- /src/test/Logo.spec.js: -------------------------------------------------------------------------------- 1 | import { mount } from '@vue/test-utils' 2 | import Logo from '@/components/Logo.vue' 3 | 4 | describe('Logo', () => { 5 | test('is a Vue instance', () => { 6 | const wrapper = mount(Logo) 7 | expect(wrapper.isVueInstance()).toBeTruthy() 8 | }) 9 | }) 10 | --------------------------------------------------------------------------------