Home > Net >  How to disable the server side of Nuxt?
How to disable the server side of Nuxt?

Time:10-01

I've made a new project in NuxtJs.

When I run npm run dev, however, it shows the following in my terminal:

√ Client
  Compiled successfully in 7.88s

√ Server
  Compiled successfully in 5.14s

Does this mean that NuxtJs automatically boots a Front-end and a back-end? If so, how can I disable/delete this back-end. A back-end will be made apart from my front-end, actually.

CodePudding user response:

Nuxt is not a backend in a sense that it will replace Express, Laravel, Ruby on Rails or alike. It's a meta framework with various capabilities like SSR (Server Side Rendering), SSG (Static Site Generation), SPA (Single Page App) and some other in between if you're using Nuxt3.

You could disable the "server" part of Nuxt by setting ssr: false but you will lose quite some performance overall. It will mainly be an improved version of Vue (understand from a Developer eXperience part) but will not be as fast as it's supposed to be for your end users.

Consider keeping Nuxt as an SSG (ssr: true target: 'static') alongside your actual "API backend".

PS: pretty much all JS meta frameworks work in this kind of way. Mainly because doing things on the server is faster/safer than doing that on your user's crappy laptop from 2000 (SPA's only basically) via pure client side.

  • Related