TrilonIO / aspnetcore-Vue-starter

*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.22k stars 266 forks source link

Can it integrate the nuxt.js to support server-side rendering? #67

Open ElderJames opened 6 years ago

ElderJames commented 6 years ago

Nuxt.js is a framework for creating Universal Vue.js Applications.

Its main scope is UI rendering while abstracting away the client/server distribution.

Our goal is to create a framework flexible enough that you can use it as a main project base or in addition to your current project based on Node.js.

Nuxt.js presets all the configuration needed to make your development of a Vue.js Application Server Rendered more enjoyable.

In addition, we also provide another deployment option called: nuxt generate. It will build a Static Generated Vue.js Application. We believe that option could be the next big step in the development of Web Applications with microservices.

As a framework, Nuxt.js comes with a lot of features to help you in your development between the client side and the server side such as Asynchronous Data, Middleware, Layouts, etc.

mcquiggd commented 6 years ago

This might give you some pointers.

https://github.com/mattjcowan/servicestack-nuxt-example

I'd be interested to see how performance of Nuxt.js SSR compares to Node Services in ASP.Net core.It still seems a bit odd to mix the two Node and ASP.Net Core technologies so closely.

Also its possible to run Nuxt 'serverless' which could be a big win for scalability - generating static pages in response to new content, for example.

MarkPieszak commented 6 years ago

I've never tried mixing Nuxt with ASP.NET Core, but I don't think it'd entirely be possible since it needs to contain all of the SSR work, dep injection and other framework abilities itself.

If you're going down the Nuxt route, I'd suggest just using Nuxt as a standalone project - and use ASP.NET Core for your REST or GraphQL API. The two will be more separated, but I'm sure there's an easy enough of a way to have the Nuxt project checked into TFS etc.

At least that way you can get the best of both worlds 👍

Hope that helps!

mcquiggd commented 6 years ago

@MarkPieszak

We reached the same conclusion - Node Services offers limited access to the request response pipeline, and probably wouldn't work with Nuxt anyway.

I use Nuxt to handle everything UI related (SSR, static generation, i18n),

While for data, business logic, and user identity management I use .Net Core via Web API / Serverless Functions in C#, which allows me to have any complicated business logic in a strongly typed language, CQRS/ ES style architectures, Akka.Net etc. etc.

The separation is a bonus, IMHO; VS Code for UI projects, full Visual Studio for anything .Net Core.

The service stack link I posted is an example of this kind of separate Nuxt | .Net approach, which convinced me I didn't have to go full Node (nothing against Node!). It's very flexible.

MarkPieszak commented 6 years ago

I agree 👍 Using VSCode for any Angular / Vue / React / TypeScript (really anything front-end) has such a better experience.

I'll have to check out servicestack, I haven't seen that before!

rwfresh commented 6 years ago

Hi All, I'm late to the game here. Maybe not :)

I've got a Vue.js webapp running through .Net Core 2.1 . I am using ASP.Net Core Identity and the controllers for a rest api. The ASP.Net Core app also delivers the one page with the vue.js app.

I would LOVE to split this out and stop using VS 2017 for the front end and would love to implement SSR. I'm really not sure how to go about this. To get SSR do I need to split this out? Is the vue.js app (single page) then served through node??

I have pretty much zero experience with node but decent experience with Vue.js in a .net core environment. I'm not afraid to learn node if it's going to get me to a best case scenario. Thanks!

ElderJames commented 6 years ago

@rwfresh You can refer my project using vue-server-renderer here: https://github.com/ElderJames/vuetify-aspnetcore .