SlideShare una empresa de Scribd logo
1 de 5
Descargar para leer sin conexión
Table of contents
Get started - Installation 5
Get started - Routing 9
Get started - Directory structure 11
Get started - Commands 13
Get started - Conclusion 16
Get started - Upgrading 17
Concepts - Views 18
Concepts - Context helpers 22
Concepts - Server side rendering 27
Concepts - Static site generation 29
Concepts - Nuxt lifecycle 30
Features - Rendering modes 35
Features - Transitions 36
Features - Live preview 40
Features - Deployment targets 42
Features - File system routing 44
Features - Data fetching 52
Features - Meta tags seo 58
Features - Configuration 61
Features - Loading 70
Features - Nuxt components 74
Features - Component discovery 81
Directory structure - Nuxt 84
Directory structure - Plugins 86
Directory structure - Static 93
Directory structure - Store 95
Directory structure - Nuxt config 100
Directory structure - Assets 107
Directory structure - Components 112
Directory structure - Content 115
Directory structure - Dist 122
Directory structure - Layouts 124
Directory structure - Middleware 126
Directory structure - Modules 128
nuxt
2
Views
The Views section describes all you need to know to configure data and views for a specific route in your
Nuxt Application. Views consist of an app template, a layout, and the actual page.
Composition of a View in Nuxt
Composition of a View in Nuxt
Pages
Every Page component is a Vue component but Nuxt adds special attributes and functions to make the de-
velopment of your application as easy as possible.
Properties of a page component
There are many properties of the page component such as the head property in the example above.
<template>
<h1 class="red">Hello World</h1>
</template>
<script>
export default {
head() {
// Set Meta Tags for this Page
}
// ...
}
</script>
<style>
.red {
color: red;
}
</style>
nuxt
18
Context and helpers
The context provides additional and often optional information about the current request to the application.
The context object is available in specific Nuxt functions like asyncData, plugins, middleware and nuxt-
ServerInit. It provides additional and often optional information about the current request to the
application.
First and foremost, the context is used to provide access to other parts of the Nuxt application, e.g. the
Vuex store or the underlying connect instance. Thus, we have the req and res objects in the context
available on the server side and store always available. But with time, the context was extended with
many other helpful variables and shortcuts. Now we have access to HMR (Hot Module Reload / Replace-
ment) functionalities in development mode, the current route , page params and query , as well as the
option to access environment variables through the context. Furthermore, module functions and helpers can
be exposed through the context to be available on both - the client and the server side.
All context keys that are present by default
nuxt
22
Nuxt Lifecycle
31
Rendering
Server Side Rendered Sites and Static Sites
Server-side rendered sites are rendered on the server each time the user requests a page, therefore a
server is needed to be able to serve the page on each request.
Static sites are very similar to server-side rendered applications with the main difference being that static
sites are rendered at build time, therefore no server is needed. Navigating from one page to another is then
on the client-side.
See deployment targets for more info on static and server hosting.
Info
You do not need to add ssr: true to your nuxt config in order to enable server-side-rendering as it is en-
abled by default.
Client Side Rendering Only
With client side rendering only there is no server-side rendering. Client side rendering means rendering the
content in the browser using JavaScript. Instead of getting all of the content from the HTML we just get a
basic HTML document with a JavaScript file that will then render the rest of the site using the browser. For
client side rendering set ssr to false .
Next
The ssr property
export default {
ssr: true // default value
}
export default {
ssr: false
}
Rendering
35

Más contenido relacionado

Similar a nuxt-sample.pdf

Building and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdfBuilding and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdfRajasreePothula3
 
Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15Akash Kant
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handsonPrashant Kumar
 
JOB PORTALProject SummaryTitle JOB-PORT.docx
JOB PORTALProject SummaryTitle    JOB-PORT.docxJOB PORTALProject SummaryTitle    JOB-PORT.docx
JOB PORTALProject SummaryTitle JOB-PORT.docxchristiandean12115
 
Sunserver Open Solaris
Sunserver Open SolarisSunserver Open Solaris
Sunserver Open Solarispankaj009
 
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdfseo18
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & DevelopmentGlobalLogic Ukraine
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...WebStackAcademy
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
Thesis klausi
Thesis klausiThesis klausi
Thesis klausimooru
 
Web and Android App Development
Web and Android App DevelopmentWeb and Android App Development
Web and Android App DevelopmentGaurav Gopal Gupta
 
Making Rational HATS a Strategic Investment
Making Rational HATS a Strategic InvestmentMaking Rational HATS a Strategic Investment
Making Rational HATS a Strategic InvestmentStrongback Consulting
 
128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.pptSaraNawghare
 
Serious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceSerious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceKlaus Hofeditz
 

Similar a nuxt-sample.pdf (20)

Building and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdfBuilding and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdf
 
Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Express node js
Express node jsExpress node js
Express node js
 
Remix
RemixRemix
Remix
 
Rendering engine
Rendering engineRendering engine
Rendering engine
 
JOB PORTALProject SummaryTitle JOB-PORT.docx
JOB PORTALProject SummaryTitle    JOB-PORT.docxJOB PORTALProject SummaryTitle    JOB-PORT.docx
JOB PORTALProject SummaryTitle JOB-PORT.docx
 
Sunserver Open Solaris
Sunserver Open SolarisSunserver Open Solaris
Sunserver Open Solaris
 
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Thesis klausi
Thesis klausiThesis klausi
Thesis klausi
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Web and Android App Development
Web and Android App DevelopmentWeb and Android App Development
Web and Android App Development
 
Making Rational HATS a Strategic Investment
Making Rational HATS a Strategic InvestmentMaking Rational HATS a Strategic Investment
Making Rational HATS a Strategic Investment
 
128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt
 
Serious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceSerious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST Interface
 

Más de ssuser65180a (16)

vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
 
vitest-en.pdf
vitest-en.pdfvitest-en.pdf
vitest-en.pdf
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
 
react-zh-hant.pdf
react-zh-hant.pdfreact-zh-hant.pdf
react-zh-hant.pdf
 
react-zh-hans.pdf
react-zh-hans.pdfreact-zh-hans.pdf
react-zh-hans.pdf
 
react-pl.pdf
react-pl.pdfreact-pl.pdf
react-pl.pdf
 
react-ko.pdf
react-ko.pdfreact-ko.pdf
react-ko.pdf
 
react-ja.pdf
react-ja.pdfreact-ja.pdf
react-ja.pdf
 
react-it.pdf
react-it.pdfreact-it.pdf
react-it.pdf
 
react-he.pdf
react-he.pdfreact-he.pdf
react-he.pdf
 
react-fr.pdf
react-fr.pdfreact-fr.pdf
react-fr.pdf
 
react-de.pdf
react-de.pdfreact-de.pdf
react-de.pdf
 
react-en.pdf
react-en.pdfreact-en.pdf
react-en.pdf
 
sveltekit-ja.pdf
sveltekit-ja.pdfsveltekit-ja.pdf
sveltekit-ja.pdf
 
svelte-ja.pdf
svelte-ja.pdfsvelte-ja.pdf
svelte-ja.pdf
 
svelte-en.pdf
svelte-en.pdfsvelte-en.pdf
svelte-en.pdf
 

Último

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 

Último (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

nuxt-sample.pdf

  • 1. Table of contents Get started - Installation 5 Get started - Routing 9 Get started - Directory structure 11 Get started - Commands 13 Get started - Conclusion 16 Get started - Upgrading 17 Concepts - Views 18 Concepts - Context helpers 22 Concepts - Server side rendering 27 Concepts - Static site generation 29 Concepts - Nuxt lifecycle 30 Features - Rendering modes 35 Features - Transitions 36 Features - Live preview 40 Features - Deployment targets 42 Features - File system routing 44 Features - Data fetching 52 Features - Meta tags seo 58 Features - Configuration 61 Features - Loading 70 Features - Nuxt components 74 Features - Component discovery 81 Directory structure - Nuxt 84 Directory structure - Plugins 86 Directory structure - Static 93 Directory structure - Store 95 Directory structure - Nuxt config 100 Directory structure - Assets 107 Directory structure - Components 112 Directory structure - Content 115 Directory structure - Dist 122 Directory structure - Layouts 124 Directory structure - Middleware 126 Directory structure - Modules 128 nuxt 2
  • 2. Views The Views section describes all you need to know to configure data and views for a specific route in your Nuxt Application. Views consist of an app template, a layout, and the actual page. Composition of a View in Nuxt Composition of a View in Nuxt Pages Every Page component is a Vue component but Nuxt adds special attributes and functions to make the de- velopment of your application as easy as possible. Properties of a page component There are many properties of the page component such as the head property in the example above. <template> <h1 class="red">Hello World</h1> </template> <script> export default { head() { // Set Meta Tags for this Page } // ... } </script> <style> .red { color: red; } </style> nuxt 18
  • 3. Context and helpers The context provides additional and often optional information about the current request to the application. The context object is available in specific Nuxt functions like asyncData, plugins, middleware and nuxt- ServerInit. It provides additional and often optional information about the current request to the application. First and foremost, the context is used to provide access to other parts of the Nuxt application, e.g. the Vuex store or the underlying connect instance. Thus, we have the req and res objects in the context available on the server side and store always available. But with time, the context was extended with many other helpful variables and shortcuts. Now we have access to HMR (Hot Module Reload / Replace- ment) functionalities in development mode, the current route , page params and query , as well as the option to access environment variables through the context. Furthermore, module functions and helpers can be exposed through the context to be available on both - the client and the server side. All context keys that are present by default nuxt 22
  • 5. Rendering Server Side Rendered Sites and Static Sites Server-side rendered sites are rendered on the server each time the user requests a page, therefore a server is needed to be able to serve the page on each request. Static sites are very similar to server-side rendered applications with the main difference being that static sites are rendered at build time, therefore no server is needed. Navigating from one page to another is then on the client-side. See deployment targets for more info on static and server hosting. Info You do not need to add ssr: true to your nuxt config in order to enable server-side-rendering as it is en- abled by default. Client Side Rendering Only With client side rendering only there is no server-side rendering. Client side rendering means rendering the content in the browser using JavaScript. Instead of getting all of the content from the HTML we just get a basic HTML document with a JavaScript file that will then render the rest of the site using the browser. For client side rendering set ssr to false . Next The ssr property export default { ssr: true // default value } export default { ssr: false } Rendering 35