import Vue from 'vue'
import Router from 'vue-router'
import Meta from 'vue-meta'

const requiredComponent = require.context('../app', true, /router.js$/)

let routes = []

requiredComponent.keys().forEach(fileName => {
  if (fileName.indexOf('_') === -1) {
    routes = [...routes, ...requiredComponent(fileName).default]
  }
})

Vue.use(Router)
Vue.use(Meta)

export default new Router({
  routes: routes,
  mode: 'hash',
})
