[
  {
    "path": ".editorconfig",
    "content": "# editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n  root: true,\n  env: {\n    browser: true,\n    node: true\n  },\n  parserOptions: {\n    parser: 'babel-eslint'\n  },\n  extends: [\n    '@nuxtjs',\n    'plugin:nuxt/recommended'\n  ],\n  plugins: [\n  ],\n  // add your custom rules here\n  rules: {}\n}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Node template\n# Logs\n/logs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# next.js build output\n.next\n\n# nuxt.js build output\n.nuxt\n\n# Nuxt generate\ndist\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless\n\n# IDE / Editor\n.idea\n\n# Service worker\nsw.*\n\n# macOS\n.DS_Store\n\n# Vim swap files\n*.swp\n"
  },
  {
    "path": "README.md",
    "content": "# Nuxt 2 with Express\n\n> [ExpressJS](http://expressjs.com/) + [Nuxt 2](https://v2.nuxt.com) = :zap:\n\nLive Demo: [https://codesandbox.io/s/github/nuxt-community/express-template](https://codesandbox.io/s/github/nuxt-community/express-template)\n\n## Nuxt 3\n\nNuxt 3 is powered by [unjs/h3](https://github.com/unjs/h3) which has a compatible API with Express and is much faster with the ability to run in Workers ([read more about it](https://nuxt.com/blog/nuxt-on-the-edge)).\n\nThis is why this template won't be migrated to Nuxt 3.\n\n## Installation\n\nThis is a template project, click on the green button \"Use this template\" at the top of this page and get started with GitHub :sparkles:\n\nOne you cloned your repository, install the dependencies with:\n\n```bash\nyarn install # or npm install\n```\n\n## ExpressJS Changes\n\n- There is a  `api` directory with the root of your `api` server.\n- The `routes` directory is called `api/routes`.\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| npm run dev | Start ExpressJS server in development with Nuxt.js in dev mode (hot reloading). Listen on [http://localhost:3000](http://localhost:3000). |\n| npm run build | Build the nuxt.js web application for production. |\n| npm start | Start ExpressJS server in production. |\n\n## Examples\n\n- [Handling Protected SSR Routes](https://github.com/nuxt/express/blob/master/protected-ssr-api.md)\n\n## Documentation\n\n- [ExpressJS](http://expressjs.com/en/guide/routing.html)\n- [Nuxt.js](https://nuxtjs.org/guide/)\n- [Vue.js](http://vuejs.org/guide/)\n\n## Licenses\n\n- [ExpressJS license](https://github.com/expressjs/express/blob/master/LICENSE)\n- [NuxtJS license](https://github.com/nuxt/nuxt.js/blob/master/LICENSE.md)\n- [VueJS license](https://github.com/vuejs/vue/blob/master/LICENSE)\n\n\n"
  },
  {
    "path": "api/index.js",
    "content": "const express = require('express')\n\n// Create express instance\nconst app = express()\n\n// Require API routes\nconst users = require('./routes/users')\nconst test = require('./routes/test')\n\n// Import API Routes\napp.use(users)\napp.use(test)\n\n// Export express app\nmodule.exports = app\n\n// Start standalone server if directly running\nif (require.main === module) {\n  const port = process.env.PORT || 3001\n  app.listen(port, () => {\n    // eslint-disable-next-line no-console\n    console.log(`API server listening on port ${port}`)\n  })\n}\n"
  },
  {
    "path": "api/routes/test.js",
    "content": "const { Router } = require('express')\n\nconst router = Router()\n\n// Test route\nrouter.use('/test', (req, res) => {\n  res.end('Test API!')\n})\n\nmodule.exports = router\n"
  },
  {
    "path": "api/routes/users.js",
    "content": "const { Router } = require('express')\n\nconst router = Router()\n\n// Mock Users\nconst users = [\n  { name: 'Alexandre' },\n  { name: 'Pooya' },\n  { name: 'Sébastien' }\n]\n\n/* GET users listing. */\nrouter.get('/users', function (req, res, next) {\n  res.json(users)\n})\n\n/* GET user by ID. */\nrouter.get('/users/:id', function (req, res, next) {\n  const id = parseInt(req.params.id)\n  if (id >= 0 && id < users.length) {\n    res.json(users[id])\n  } else {\n    res.sendStatus(404)\n  }\n})\n\nmodule.exports = router\n"
  },
  {
    "path": "assets/README.md",
    "content": "# ASSETS\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains your un-compiled assets such as LESS, SASS, or JavaScript.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).\n"
  },
  {
    "path": "components/Logo.vue",
    "content": "<template>\n  <svg class=\"NuxtLogo\" width=\"245\" height=\"180\" viewBox=\"0 0 452 342\" xmlns=\"http://www.w3.org/2000/svg\">\n    <path\n      d=\"M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z\"\n      fill=\"#00C58E\"\n    />\n    <path\n      d=\"M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z\"\n      fill=\"#108775\"\n    />\n    <path\n      d=\"M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z\"\n      fill=\"#2F495E\"\n    />\n  </svg>\n</template>\n\n<style>\n.NuxtLogo {\n  animation: 1s appear;\n  margin: auto;\n}\n\n@keyframes appear {\n  0% {\n    opacity: 0;\n  }\n}\n</style>\n"
  },
  {
    "path": "components/README.md",
    "content": "# COMPONENTS\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThe components directory contains your Vue.js Components.\n\n_Nuxt.js doesn't supercharge these components._\n"
  },
  {
    "path": "layouts/README.md",
    "content": "# LAYOUTS\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains your Application Layouts.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).\n"
  },
  {
    "path": "layouts/default.vue",
    "content": "<template>\n  <div>\n    <Nuxt />\n  </div>\n</template>\n\n<style>\nhtml {\n  font-family:\n    'Source Sans Pro',\n    -apple-system,\n    BlinkMacSystemFont,\n    'Segoe UI',\n    Roboto,\n    'Helvetica Neue',\n    Arial,\n    sans-serif;\n  font-size: 16px;\n  word-spacing: 1px;\n  -ms-text-size-adjust: 100%;\n  -webkit-text-size-adjust: 100%;\n  -moz-osx-font-smoothing: grayscale;\n  -webkit-font-smoothing: antialiased;\n  box-sizing: border-box;\n}\n\n*,\n*::before,\n*::after {\n  box-sizing: border-box;\n  margin: 0;\n}\n\n.button--green {\n  display: inline-block;\n  border-radius: 4px;\n  border: 1px solid #3b8070;\n  color: #3b8070;\n  text-decoration: none;\n  padding: 10px 30px;\n}\n\n.button--green:hover {\n  color: #fff;\n  background-color: #3b8070;\n}\n\n.button--grey {\n  display: inline-block;\n  border-radius: 4px;\n  border: 1px solid #35495e;\n  color: #35495e;\n  text-decoration: none;\n  padding: 10px 30px;\n  margin-left: 15px;\n}\n\n.button--grey:hover {\n  color: #fff;\n  background-color: #35495e;\n}\n\n</style>\n"
  },
  {
    "path": "layouts/error.vue",
    "content": "<template>\n  <section class=\"container\">\n    <div>\n      <Logo />\n      <h1 class=\"title\">\n        {{ error.statusCode }}\n      </h1>\n      <h2 class=\"info\">\n        {{ error.message }}\n      </h2>\n      <nuxt-link v-if=\"error.statusCode === 404\" class=\"button\" to=\"/\">\n        Homepage\n      </nuxt-link>\n    </div>\n  </section>\n</template>\n\n<script>\nexport default {\n  props: {\n    error: {\n      type: Object,\n      default: () => ({})\n    }\n  }\n}\n</script>\n\n<style scoped>\n.container {\n  margin: 0 auto;\n  min-height: 100vh;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n\n.title {\n  font-family:\n    'Quicksand',\n    'Source Sans Pro',\n    -apple-system,\n    BlinkMacSystemFont,\n    'Segoe UI',\n    Roboto,\n    'Helvetica Neue',\n    Arial,\n    sans-serif;\n  display: block;\n  font-weight: 300;\n  font-size: 100px;\n  color: #35495e;\n  letter-spacing: 1px;\n}\n.info\n{\n  font-weight: 300;\n  color: #9aabb1;\n  margin: 0;\n}\n.button\n{\n  margin-top: 50px;\n}\n</style>\n"
  },
  {
    "path": "middleware/README.md",
    "content": "# MIDDLEWARE\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains your application middleware.\nMiddleware let you define custom functions that can be run before rendering either a page or a group of pages.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).\n"
  },
  {
    "path": "nuxt.config.js",
    "content": "\nexport default {\n  /*\n  ** Nuxt target\n  ** See https://nuxtjs.org/api/configuration-target\n  */\n  target: 'server',\n\n  /*\n  ** Headers of the page\n  ** See https://nuxtjs.org/api/configuration-head\n  */\n  head: {\n    title: process.env.npm_package_name || '',\n    meta: [\n      { charset: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }\n    ],\n    link: [\n      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }\n    ]\n  },\n\n  /*\n  ** Global CSS\n  */\n  css: [\n  ],\n\n  /*\n  ** Plugins to load before mounting the App\n  ** https://nuxtjs.org/guide/plugins\n  */\n  plugins: [\n  ],\n\n  /*\n  ** Auto import components\n  ** See https://nuxtjs.org/api/configuration-components\n  */\n  components: true,\n\n  /*\n  ** Nuxt.js dev-modules\n  */\n  buildModules: [\n    // Doc: https://github.com/nuxt-community/eslint-module\n    '@nuxtjs/eslint-module'\n  ],\n\n  /*\n  ** Nuxt.js modules\n  */\n  modules: [\n    // Doc: https://http.nuxtjs.org\n    '@nuxt/http'\n  ],\n\n  /*\n  ** Server Middleware\n  */\n  serverMiddleware: {\n    '/api': '~/api'\n  },\n\n  /*\n  ** For deployment you might want to edit host and port\n  */\n  // server: {\n  //  port: 8000, // default: 3000\n  //  host: '0.0.0.0' // default: localhost\n  // },\n\n  /*\n  ** Build configuration\n  ** See https://nuxtjs.org/api/configuration-build/\n  */\n  build: {\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"nuxt-express\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"nuxt\",\n    \"build\": \"nuxt build\",\n    \"start\": \"nuxt start\",\n    \"generate\": \"nuxt generate\",\n    \"lint\": \"yarn lint:js\",\n    \"lint:js\": \"eslint --ext .js,.vue --ignore-path .gitignore .\"\n  },\n  \"dependencies\": {\n    \"@nuxt/http\": \"latest\",\n    \"express\": \"latest\",\n    \"nuxt\": \"latest\"\n  },\n  \"devDependencies\": {\n    \"@nuxtjs/eslint-config\": \"^5.0.0\",\n    \"@nuxtjs/eslint-module\": \"^3.0.2\",\n    \"babel-eslint\": \"^10.1.0\",\n    \"eslint\": \"^7.20.0\",\n    \"eslint-plugin-nuxt\": \"^2.0.0\"\n  }\n}\n"
  },
  {
    "path": "pages/README.md",
    "content": "# PAGES\n\nThis directory contains your Application Views and Routes.\nThe framework reads all the `*.vue` files inside this directory and creates the router of your application.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).\n"
  },
  {
    "path": "pages/index.vue",
    "content": "<template>\n  <div class=\"container\">\n    <div>\n      <Logo />\n      <h1 class=\"title\">\n        nuxt-express\n      </h1>\n      <div>\n        {{ test }}\n        <div class=\"links\">\n          <a\n            href=\"/users\"\n            class=\"button--green\"\n          >\n            Users List\n          </a>\n        </div>\n      </div>\n      <div class=\"links\">\n        <a\n          href=\"https://nuxtjs.org/\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n          class=\"button--green\"\n        >\n          Documentation\n        </a>\n        <a\n          href=\"https://github.com/nuxt/nuxt.js\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n          class=\"button--grey\"\n        >\n          GitHub\n        </a>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script>\nexport default {\n  async asyncData ({ $http }) {\n    const test = await $http.$get('/api/test')\n    return {\n      test\n    }\n  }\n}\n</script>\n\n<style scoped>\n.container {\n  margin: 0 auto;\n  min-height: 100vh;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n\n.title {\n  font-family:\n    'Quicksand',\n    'Source Sans Pro',\n    -apple-system,\n    BlinkMacSystemFont,\n    'Segoe UI',\n    Roboto,\n    'Helvetica Neue',\n    Arial,\n    sans-serif;\n  display: block;\n  font-weight: 300;\n  font-size: 100px;\n  color: #35495e;\n  letter-spacing: 1px;\n}\n\n.subtitle {\n  font-weight: 300;\n  font-size: 42px;\n  color: #526488;\n  word-spacing: 5px;\n  padding-bottom: 15px;\n}\n\n.links {\n  padding-top: 15px;\n}\n</style>\n"
  },
  {
    "path": "pages/users/_id.vue",
    "content": "<template>\n  <section class=\"container\">\n    <div>\n      <Logo />\n      <h1 class=\"title\">\n        User\n      </h1>\n      <h2 class=\"info\">\n        {{ user.name }}\n      </h2>\n      <nuxt-link class=\"button\" to=\"/users\">\n        Users\n      </nuxt-link>\n    </div>\n  </section>\n</template>\n\n<script>\nexport default {\n  asyncData ({ params, error, $http }) {\n    return $http.$get('/api/users/' + params.id)\n      .then((res) => {\n        return { user: res }\n      })\n      .catch((e) => {\n        error({ statusCode: 404, message: 'User not found' })\n      })\n  },\n  head () {\n    return {\n      title: `User: ${this.user.name}`\n    }\n  }\n}\n</script>\n\n<style scoped>\n.container {\n  margin: 0 auto;\n  min-height: 100vh;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n.title\n{\n  margin-top: 30px;\n}\n.info\n{\n  font-weight: 300;\n  color: #9aabb1;\n  margin: 0;\n  margin-top: 10px;\n}\n.button\n{\n  margin-top: 30px;\n}\n</style>\n"
  },
  {
    "path": "pages/users/index.vue",
    "content": "<template>\n  <section class=\"container\">\n    <div>\n      <Logo />\n      <h1 class=\"title\">\n        USERS\n      </h1>\n      <ul class=\"users\">\n        <li v-for=\"(user, index) in users\" :key=\"index\" class=\"user\">\n          <nuxt-link :to=\"{ name: 'users-id', params: { id: index }}\">\n            {{ user.name }}\n          </nuxt-link>\n        </li>\n      </ul>\n      <nuxt-link class=\"button\" to=\"/\">\n        Homepage\n      </nuxt-link>\n    </div>\n  </section>\n</template>\n\n<script>\nexport default {\n  async asyncData ({ $http }) {\n    const data = await $http.$get('/api/users')\n    return { users: data }\n  },\n  head () {\n    return {\n      title: 'Users'\n    }\n  }\n}\n</script>\n\n<style scoped>\n.container {\n  margin: 0 auto;\n  min-height: 100vh;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n.title\n{\n  margin: 30px 0;\n}\n.users\n{\n  list-style: none;\n  margin: 0;\n  padding: 0;\n}\n.user\n{\n  margin: 10px 0;\n}\n.button\n{\n  display: inline-block;\n  margin-top: 50px;\n}\n</style>\n"
  },
  {
    "path": "plugins/README.md",
    "content": "# PLUGINS\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains Javascript plugins that you want to run before mounting the root Vue.js application.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).\n"
  },
  {
    "path": "protected-ssr-api.md",
    "content": "The moment you start dealing with user session, you'll notice that protected routes will reject nuxt requests when running from the server. This is because when nuxt is ran from the server, the browser cookie is lost. Below is a quick middleware solution to inject the browser's cookie to your ssr axios request.\n\n## install session\n\n`npm install --save express-session`\n\n\n## create middleware/ssr-cookie.js\n\n```js\nimport axios from '~plugins/axios'\n\nexport default function({isServer, req}) {\n  if (isServer) {\n    axios.defaults.headers.common.cookie = req.headers.cookie\n  }\n}\n```\n\n## add middleware to nuxt.config.js\n\n```js\nrouter: {\n  middleware: ['ssr-cookie']\n}\n```\n\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"extends\": [\n    \"@nuxtjs\"\n  ]\n}\n"
  },
  {
    "path": "static/README.md",
    "content": "# STATIC\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains your static files.\nEach file inside this directory is mapped to `/`.\nThus you'd want to delete this README.md before deploying to production.\n\nExample: `/static/robots.txt` is mapped as `/robots.txt`.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).\n"
  },
  {
    "path": "store/README.md",
    "content": "# STORE\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains your Vuex Store files.\nVuex Store option is implemented in the Nuxt.js framework.\n\nCreating a file in this directory automatically activates the option in the framework.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).\n"
  }
]