text: const bodyParser = require('body-parser')
  const axios = require('axios')
  
  module.exports = {
    /*
    ** Headers of the page
    */
    head: {
      title: 'nuxt-blog',
      meta: [
        { charset: 'utf-8' },
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        { hid: 'description', name: 'description', content: 'simple blog in nuxt' }
      ],
      link: [
        { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
        { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' }
      ]
    },
    plugins: ['~/plugins/vuetify.js'],
    modules: [
      '@nuxtjs/axios',
      '@nuxtjs/pwa'
    ],
    axios: {
      baseURL: process.env.BASE_URL || 'https://nuxt-blog-77f0e.firebaseio.com'
    },
    css: [
      '~/assets/style/app.styl'
    ],
    /*
    ** Customize the progress bar color
    */
    loading: { color: '#3B8070' },
    /*
    ** Build configuration
    */
    build: {
      vendor: [
        '~/plugins/vuetify.js'
      ],
      extractCSS: true,
      /*
      ** Run ESLint on save
      */
      extend (config, ctx) {
        if (ctx.isDev && ctx.isClient) {
          config.module.rules.push({
            enforce: 'pre',
            test: /\.(js|vue)$/,
            loader: 'eslint-loader',
            exclude: /(node_modules)/
          })
        }
      }
    },
    env: {
      baseUrl: process.env.BASE_URL || 'https://nuxt-blog-77f0e.firebaseio.com',
      fbAPIKey: 'AIzaSyDOyVZot9nyGEsDUSHO0Ml2IWKtVAyu9mA'
    },
    transition: {
      name: 'fade',
      mode: 'out-in'
    },
    serverMiddleware: [
      bodyParser.json(),
      '~/api'
    ],
    generate: {
      routes: function () {
        return axios.get('https://nuxt-blog-77f0e.firebaseio.com/posts.json')
        .then(res => {
          const routes = []
          for (const key in res.data) {
            routes.push({
              route: '/posts/' + key,
              payload: {postData: res.data[key]}
           })
          }
          return routes
        })
      }
    }
  }
  