SlideShare a Scribd company logo
SEBASTIEN CHOPIN
Github & Twitter: Atinux
Working @ Neo.9
Paris
Nuxt Talk
A Framework for
Server-rendered Vue.js Applications
Inspired by Next.js
Built on top of Vue.js 2
Server-side Rendering
With Node.js
ES6 Transpilation
With Babel
Automatic Code Splitting
Every routes and layouts
Hot Reloading
With Webpack + Vue-Loader
Focus on writing
*.vue files
USAGE
npm install --save nuxt
Nuxt Talk
Nuxt Talk
npm run dev
Nuxt Talk
Nuxt Talk
DEMO
ROUTING
pages/ is the main API
pages/index.vue —> /
Simple Routes
pages/about.vue —> /about
pages/_.vue —> /*
pages/users/_id.vue —> /users/:id
Dynamic Routes
Nested Routes
pages/users/_id.vue —> Parent View
pages/users/_id/index.vue —> Child View
pages/users/_id/feed.vue —> Child View
<nuxt-link>
<nuxt-link>About page</nuxt-link>
<nuxt-link to=“/about”>About page</nuxt-link>
Same as router-link
DEMO
ASYNC DATA
Nuxt Talk
Nuxt Talk
Nuxt Talk
Nuxt Talk
Nuxt Talk
Nuxt Talk
Nuxt Talk
DEMO
CONTEXT
asyncData(context)
Key Type Where Description
isClient Boolean Client & Server true on client-side
isServer Boolean Client & Server true on server-side
isDev Boolean Client & Server true on development
env Object Client & Server Object defined in nuxt.config.js
asyncData(context)
Key Type Where Description
route
Route Instance
(vue-router)
Client & Server Route object given by vue-router
params Object Client & Server Alias of route.params
query Object Client & Server Alias of route.query
store
Store Instance
(vuex)
Client & Server
Vuex store instance
(only when store activated)
asyncData(context)
Key Type Where Description
req http.Request Server Request from the node.js server.
res http.Response Server Response from the node.js server.
redirect Function Client & Server redirect([statusCode,] path [, query])
error Function Client & Server error({ statusCode, message })
Nuxt Talk
LAYOUTS
Add a layouts/ directory
layouts/default.vue
layouts/dark.vue
pages/index.vue
DEMO
STORE
With Vuex
Add a store/ directory
store/index.js pages/index.vue
pages/about.vue
pages/index.vuestore/index.js
pages/about.vue
DEMO
(async) nuxtServerInit action
MIDDLEWARE
Add a middleware/ directory
middleware/auth.js
pages/secret.vue
Nuxt Talk
DEMO
CONFIGURATION
Via nuxt.config.js
HEAD ELEMENTS
With vue-meta
Nuxt Talk
USE IT
PROGRAMMATICALLY
Nuxt Talk
Express middleware
app.use(nuxt.render)
SERVER DEPLOYMENT
With now.sh
Nuxt Talk
now
That’s it.
STATIC GENERATION
nuxt generate
Nuxt Talk
pages/index.vue —> /dist/index.html
nuxt generate
pages/about.vue —> /dist/about/index.html
now dist/
That’s it.
Github: nuxt/nuxt.js
Version: 0.10.6
30+ contributors
100% coverage
500+ issues closed
30+ examples
3,8K+ stars in 6 months
Coming soon:
nuxtjs.org
5 Languages
Made with nuxt.js
200K+ page views / month
CO-AUTHOR
ALEXANDRE CHOPIN
Github: alexchopin
Versatile Web Application
NEXT
ssr: false
nuxt.config.js layout page
MORE OPEN SOURCE
https://orion.sh
THANK YOU
Ad

More Related Content

What's hot (20)

Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
Anjali Chawla
 
Webpack
WebpackWebpack
Webpack
Anjali Chawla
 
Webpack
Webpack Webpack
Webpack
DataArt
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
NodeXperts
 
Node.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash CourseNode.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash Course
Aaron Silverman
 
Sails.js Intro
Sails.js IntroSails.js Intro
Sails.js Intro
Nicholas Jansma
 
Single Page Apps with Drupal 8
Single Page Apps with Drupal 8Single Page Apps with Drupal 8
Single Page Apps with Drupal 8
Chris Tankersley
 
Webpack DevTalk
Webpack DevTalkWebpack DevTalk
Webpack DevTalk
Alessandro Bellini
 
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
Squash Apps Pvt Ltd
 
Webpack slides
Webpack slidesWebpack slides
Webpack slides
Андрей Вандакуров
 
Webpack: your final module bundler
Webpack: your final module bundlerWebpack: your final module bundler
Webpack: your final module bundler
Andrea Giannantonio
 
A New Vue for Web Development
A New Vue for Web DevelopmentA New Vue for Web Development
A New Vue for Web Development
Chad Campbell
 
ZK framework
ZK frameworkZK framework
ZK framework
CELSTEC (Open Universiteit Nederland)
 
Angular2 ecosystem
Angular2 ecosystemAngular2 ecosystem
Angular2 ecosystem
Kamil Lelonek
 
Bower power
Bower powerBower power
Bower power
Eric Carlisle
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JS
Emil Öberg
 
Javascript Bundling and modularization
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularization
stbaechler
 
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Ryan Roemer
 
006. React - Redux framework
006. React - Redux framework006. React - Redux framework
006. React - Redux framework
Binh Quan Duc
 
Webpack
Webpack Webpack
Webpack
Sofian Hadiwijaya
 

Similar to Nuxt Talk (20)

Love at first Vue
Love at first VueLove at first Vue
Love at first Vue
Dalibor Gogic
 
Nuxtjs cheat-sheet
Nuxtjs cheat-sheetNuxtjs cheat-sheet
Nuxtjs cheat-sheet
ValeriaCastillo71
 
Building the Front End with AngularJS
Building the Front End with AngularJSBuilding the Front End with AngularJS
Building the Front End with AngularJS
John Ennew
 
Vuejs for Angular developers
Vuejs for Angular developersVuejs for Angular developers
Vuejs for Angular developers
Mikhail Kuznetcov
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
Fwdays
 
What is Vuejs.pptx
What is Vuejs.pptxWhat is Vuejs.pptx
What is Vuejs.pptx
NhnHVn2
 
Server Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.jsServer Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.js
Jessie Barnett
 
Browserify
BrowserifyBrowserify
Browserify
davidchubbs
 
Extending Kubectl.pptx
Extending Kubectl.pptxExtending Kubectl.pptx
Extending Kubectl.pptx
LibbySchulze
 
Meet VueJs
Meet VueJsMeet VueJs
Meet VueJs
Mathieu Breton
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web AppNode JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web App
Edureka!
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
Commit University
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
Violetta Villani
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express Framework
Edureka!
 
Provisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azureProvisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azure
Patriek van Dorp
 
ContainerDayVietnam2016: Docker for JS Developer
ContainerDayVietnam2016: Docker for JS DeveloperContainerDayVietnam2016: Docker for JS Developer
ContainerDayVietnam2016: Docker for JS Developer
Docker-Hanoi
 
Azure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstartAzure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstart
Davide Mauri
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Pagepro
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACS
Ricardo Alcocer
 
Building the Front End with AngularJS
Building the Front End with AngularJSBuilding the Front End with AngularJS
Building the Front End with AngularJS
John Ennew
 
Vuejs for Angular developers
Vuejs for Angular developersVuejs for Angular developers
Vuejs for Angular developers
Mikhail Kuznetcov
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
Fwdays
 
What is Vuejs.pptx
What is Vuejs.pptxWhat is Vuejs.pptx
What is Vuejs.pptx
NhnHVn2
 
Server Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.jsServer Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.js
Jessie Barnett
 
Extending Kubectl.pptx
Extending Kubectl.pptxExtending Kubectl.pptx
Extending Kubectl.pptx
LibbySchulze
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web AppNode JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web App
Edureka!
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
Commit University
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
Violetta Villani
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express Framework
Edureka!
 
Provisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azureProvisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azure
Patriek van Dorp
 
ContainerDayVietnam2016: Docker for JS Developer
ContainerDayVietnam2016: Docker for JS DeveloperContainerDayVietnam2016: Docker for JS Developer
ContainerDayVietnam2016: Docker for JS Developer
Docker-Hanoi
 
Azure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstartAzure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstart
Davide Mauri
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Pagepro
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACS
Ricardo Alcocer
 
Ad

Recently uploaded (20)

Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Ad

Nuxt Talk

Editor's Notes

  • #2: Hello everyone. [CLICK] My name is Sebastien, I am French, sorry for my accent 😄, I am currently working at Neo 9 in Paris.
  • #3: Today I am going to talk about Nuxt.js, first, what is Nuxt.js?
  • #4: Nuxt.js is an open-source project and it's a framework for server-rendered Vue.js applications. [CLICK] It’s inspired by Next.js
  • #5: It is built on top of Vue.js 2.1 and the latest version of Vue-router
  • #6: One of it’s main feature is to allow your application to be server rendered without any extra setup.
  • #7: You can write ES6 in your code. [CLICK] Nuxt.js uses Babel to transpile your code and make it work for most of the platforms.
  • #8: Nuxt.js uses Webpack to split your application into multiple file. When the browser load your application, only the strict minimum of JavaScript and CSS will be sent back. [CLICK] You don’t have to do anything, it’s automatic for every routes and layouts.
  • #9: Nuxt.js also provides hot reloading [CLICK] thanks to Webpack and Vue Loader to improves your development experience.
  • #10: The only thing you have to do is to focus on writing VUE files.
  • #11: Let’s see a quick how to use Nuxt.js
  • #12: First, we need to install nuxt as a dependency of our application with npm
  • #13: We can add a “dev" script in our package.json to launch nuxt.js.
  • #14: And then we can create our first page. Here we have a template displaying the name property of our page data, and we set the name to world.
  • #15: I can now launch Nuxt with npm run dev
  • #16: Nuxt will generate the routes, bundle your files and run a server on localhost.
  • #17: If we visit this url in the browser, we can see our index.vue page server-rendered.
  • #18: Let’s see how it looks like in live.
  • #19: Let’s see how the routing works in Nuxt
  • #20: Nuxt.js will match every vue file in our pages directory to a route in our server
  • #21: [CLICK] So for our index.vue page, it will be the slash route, [CLICK] and for about.vue, the /about route
  • #22: We can also create dynamic routes, just prefix your route by an underscore to become a dynamic route. [CLICK] The name of file will become a parameter of the route. [CLICK] If you create a page with only an underscore, it will be a wildcard route.
  • #23: We pushed the routing concept to supports nested routes.[CLICK] By having a directory with the same name of a file, it opens the possibility to create child routes.[CLICK] The will be rendered only when the url will match its path.
  • #24: To navigate between the pages, we added a component called nuxt-link
  • #25: This is how it looks like to create a link
  • #26: To navigate to the about page, We add the to attribute. [CLICK] It’s usage is the same as router-link since we use vue-router under the hood
  • #27: Supports async/await
  • #28: Every web application needs to make API calls which are asynchronous. That’s why, like next.js, we added a hook in the pages component to handle this issue.
  • #29: Let’s start with a simple template
  • #30: We display a list of posts by showing the title of every post
  • #31: We now add our list of posts in our data hook. But this is not asynchronous
  • #32: First, let's rename our data method to asyncData
  • #33: We also add the async keyword to use await inside since Nuxt transpiles ES6
  • #34: We need to import axios to make an API call. Axios lets us make HTTP request to both client-side and server-side with the same api.
  • #35: We can now fetch our API to get the list of posts and display it.
  • #36: Let’s see how it looks like
  • #37: Nuxt passes a context object to the asyncData method which helps to in many ways
  • #38: First, we have some helpers like isClient, isServer and isDev which are boolean and guide you to know where the method is run. We have the env property that you can define in the config file.
  • #39: Then we have the route property, which is an instance of vue-router, params and query if you want to get informations from the current url. We also have store, but we will see this property later.
  • #40: To finish, we have our 2 properties from our node.js server, only available when we render the page from the server of course. And 2 methods, one to redirect to another page and error to display the error page.
  • #41: Let’s see an example, I want a page to display the current user agent, this is how I can do it in nuxt, if req is available, so I’m on the server, I get it from the headers, otherwise I get it from the navigator object available on client-side.
  • #42: We added a Layout concept in Nuxt
  • #43: First, we create a layouts directory in our application
  • #44: We can change the default layout for every page by creating a default.vue component. We simply add the nuxt component to render our current page.
  • #45: Let’s create a custom layout called dark.vue which encapsulate our page in a container with the dark-mode class.
  • #46: Then, I can tell for a specific page which layout I want to use with the layout property.
  • #47: Let’s see a quick example.
  • #48: Every big application needs a global state for every pages. So we added the store concept [CLICK] based on VUEX.
  • #49: We add a store directory first.
  • #50: Then we simply export a state object, here with a count property at 0. [CLICK] Now let’s display the count property in our index page. [CLICK] And also in our about page.
  • #51: We now add a mutation to increment our count property. [CLICK] We update our about page to add a button which call the increment mutation every time we click on it. [CLICK]
  • #52: Let’s see how it looks like on now.
  • #53: We added a special action called nuxt server init which is called by the server before rendering the application. It may useful to store the connected user or fetch some global data and make it available on client-side directly.
  • #54: Another concept, but for me pretty useful, is the middleware.
  • #55: Same philosophy, we add a middleware directory.
  • #56: A middleware is only a method which receive the context and can be asynchronous. Here we simply check our user is connected, otherwise we redirect the user to the login page.
  • #57: In the page we want to display only to connected user, we add the middleware property and give our auth middleware.
  • #58: This is a schema to represent what’s happening on an incoming request. The nuxtServerInit is called first if the store is available, then the middleware chain, the validate method that we did not see here, the asyncData & fetch method and then we render our application.
  • #59: Let’s see a quick demo!
  • #60: Nuxt is fully customisable with a nuxt.config.js file. With this file, we can modify the webpack & babel configuration, add vue plugins and more.
  • #61: Head elements are important for any web page, mostly when server-rendered. [CLICK] We use vue-meta to handle this logic via a head property available in the config file, layouts or any pages.
  • #62: I believe this example is explicit enough to understand how it works.
  • #63: One powerful way of using Nuxt.js is to use it programmatically
  • #64: Simply require nuxt, and create a new instance of it by giving it the configuration it needs. The call the build() method and you’re ready to render every route you want.
  • #65: Also, you can combine it with express by using it as a middleware.
  • #66: Let’s see how we can deploy any nuxt.js application. [CLICK] With now
  • #67: We add 2 script, one for building the app for production, we call nuxt build, and the one to start in production mode, called nuxt start.
  • #68: Then we go to our terminal, in our app folder, and we launch `now` command. [CLICK] And that’s it, your app is up and running on the cloud.
  • #69: Nuxt can also be used as a static generator for your website, that’s actually what we do to serve our documentation on nuxtjs.org. [CLICK] The command is called `nuxt generate`
  • #70: You can add a nom script to call `nuxt generate` directly.
  • #71: This command will actually server-render every route and save it to an HTML file in a folder structure that correspond to each route. It will also put all of theses files in a dist/ folder.
  • #72: Since now can host static website, we can also deploy our static generated web application by running `now dist`. [CLICK] And…that’s it!
  • #73: The project is hosted on Github. [CLICK] Right now we are at the version 0.10.6 but we are working on releasing the 1.0 beta pretty soon. [CLICK] We add more than 30 contributors, thank you to all of them. [CLICK] We have 100% of code coverage. [CLICK] More than 500 issues closed, big thanks to our community to help us on theses issues. [CLICK] Also, more than 30 examples to use Nuxt with Vue plugins, Express, Koa, Adonis and more. [CLICK] And all of this, in 6 months.
  • #74: We have a documentation website on nuxtjs.org. [CLICK] Right now, it has been translated in 5 different languages, English, Russian, Chineese, Japanese en Koean. [CLICK] We have 2 new languages on their way, French and Spanish. [CLICK] A lot of people from different countries are reading it. [CLICK] And it has been made with NuxtJS.
  • #75: I have to thanks a million time my brother, which is the co-author of Nuxt, he came with the static generation feature. He helped me in the vision of Nuxt, and the biggest part: maintaining it! If you have the chance to work with your brother of sister on a project, do it!
  • #76: So What’s next apart of the 1.0 release. [CLICK] I would like to introduce the concept of Versatile Web application. It gives you control of what you want to server render or not in your application. [CLICK] It will be a simple property called ssr, default to true. [CLICK] You will be able to set it to false for the whole app. [CLICK] A custom layout, for example the back office. [CLICK] Or a specific page.
  • #77: With my brother, we are working on other open source projects that we will announce soon. [CLICK] You can be notified on our website orion.sh, I recommend you to take a look at it.
  • #78: Thank you very much for you time!