Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Express with my nuxt app? #563

Open
paulgrasser opened this issue Jun 29, 2020 · 22 comments
Open

Express with my nuxt app? #563

paulgrasser opened this issue Jun 29, 2020 · 22 comments

Comments

@paulgrasser
Copy link

I noticed that I cannot specify my backend framework anymore, in this case I would like to use express. Is this just not possible anymore?

@jerosoler
Copy link

View #559 and #501

Is deprecated in version 3.0

Use nuxt-render https://nuxtjs.org/api/nuxt-render or serverMiddleware https://nuxtjs.org/api/configuration-servermiddleware

@robbylucia
Copy link

View #559 and #501

Is deprecated in version 3.0

Use nuxt-render https://nuxtjs.org/api/nuxt-render or serverMiddleware https://nuxtjs.org/api/configuration-servermiddleware

Why was it deprecated?

@jerosoler
Copy link

Server templates

@robbylucia
Copy link

For anyone who doesn't want to drop their current workflow, you can just use the latest working version with this command:
npx create-nuxt-app@2.15.0

@wizardpisces
Copy link

wizardpisces commented Jul 10, 2020

More time consuming to use Nuxt....

Where can we see the discussed various reasons about why removing the server template? I could not see the necessity of it...
From my perspective, it's another feature which only increasing the mental burden and nothing more.
Forgive my ability to understand the new docs, so we are stuck to Connect middleware ?
I could not find where to switch to koa or express middleware, anyone found it? Please give me some tip...

@pi0
Copy link
Member

pi0 commented Jul 10, 2020

Hi. I can fully understand suddenly changing workflow that some users used to would be hard.

We had to remove programmatic usage of Nuxt from CNA template because otherwise more and more users could wrongly choose this option which is not a good practice for most use cases because of several DX issues (like full server reload) and deployment (loading correct dist assets) also issues for ESM and typescript support.

This doesn't mean we deprecated programmatic usage and it was even improved recently nuxt/nuxt#6868 (docs) and will be better in nuxt3 for first class serverless and custom server support but it is only recommended for advanced users that can handle all edge cases thus removed from CNA template. The current alternative recommended approach is using a serverMiddleware to use express for API routes (supports HMR as well) or using separate server or serverless functions.

There are also custom backend templates: (maybe outdated)

Articles:

@JordashTalon
Copy link

I'm having a lot of trouble connecting the dots with this documentation:

https://nuxtjs.org/api/configuration-servermiddleware

I don't see how that explains that now that the express option is removed how do I use the server middleware to create an express app that runs parallel to the Nuxt app? Is there a more in-depth tutorial for that process?

@JordashTalon
Copy link

JordashTalon commented Jul 16, 2020

@jerosoler

I'm looking at this page as well: https://nuxtjs.org/api/nuxt-render

And i'm not sure where to put that code for the express example, what file should that code go in?

EDIT:

For anyone having a lot of trouble with this new setup like I was I found this tutorial to be super helpful:
https://bithacker.dev/use-express-with-nuxt-js

@jerosoler
Copy link

@JordashTalon

Use command with old version and compare with new version.
npx create-nuxt-app@2.15.0

@JordashTalon
Copy link

@jerosoler Ok, would be nice if they had a full example in the documentation, it's really vague

@SwapnilSoni1999
Copy link

@JordashTalon agreed

@robbylucia
Copy link

@pi0 Thank you so much for the detailed update.
I don't want to be a nuisance, nor do I want to seem like I'm demanding anything-- just asking:
Will the improvements in Nuxt3 bring back the easy "one-click-install" experience that server template users were used to? As of now I am continuing to use version 2.15.0 until further notice.

Sorry if this has been answered elsewhere.

@dan-hammond
Copy link

@pi0 this documentation states that you must choose a back-end in order to host in Azure:
https://nuxtjs.org/faq/deployment-azure-portal/

Is that still the case? What should I be doing instead please?

Thanks

@ideacco
Copy link

ideacco commented Aug 20, 2020

@pi0 Thank you so much for the detailed update.
I don't want to be a nuisance, nor do I want to seem like I'm demanding anything-- just asking:
Will the improvements in Nuxt3 bring back the easy "one-click-install" experience that server template users were used to? As of now I am continuing to use version 2.15.0 until further notice.

Sorry if this has been answered elsewhere.

one-click-install It's what I want. If I can, it's "great again."

@pi0
Copy link
Member

pi0 commented Sep 2, 2020

@dan-hammond Docs is outdated unfortounatly. I know @f3ltron is working on an article for azure :) (spoiler)

@ideacco @robbylucia Your demand is correct. Nuxt 3 would generate a server.js by default so it is zero click ;) Meanwhile you can use express-template which is properly configuring express api as a serverMiddleware.

@robbylucia
Copy link

@dan-hammond Docs is outdated unfortounatly. I know @f3ltron is working on an article for azure :) (spoiler)

@ideacco @robbylucia Your demand is correct. Nuxt 3 would generate a server.js by default so it is zero click ;) Meanwhile you can use express-template which is properly configuring express api as a serverMiddleware.

server.js by default? That's amazing. I look forward to it

@flozero
Copy link

flozero commented Sep 2, 2020

It wll take a bit of time but I am working on it as much as possible. It's already working now ii have to write a good article. but soon soon :). Thank's @pi0

@StEvUgnIn
Copy link

I am having a headache trying to connect node-spdy over nuxt. I am using express to call app.use(nuxt.render).

All I get is a HTTP/1.1 connection over SSL. This is really exhausting.

@carloslema
Copy link

Indeed, very exhausting! I was trying to migrate a vue-express SPA to SSR to end up with MPA that uses socket.io with Google APIs, stripe and peerjs, what a headache — I am keeping an open mind about Nuxt and the team's great work.

@bi-kai
Copy link

bi-kai commented Feb 12, 2021

@dan-hammond Docs is outdated unfortounatly. I know @f3ltron is working on an article for azure :) (spoiler)

@ideacco @robbylucia Your demand is correct. Nuxt 3 would generate a server.js by default so it is zero click ;) Meanwhile you can use express-template which is properly configuring express api as a serverMiddleware.

how about koa-template, it hasn't been updated for 3 years.

@JamesAlphonse
Copy link

Man this is a stupid change. Removing a feature because you think we're too dumb to use it correctly. All it does is make using your platform more complicated, confusing and time consuming. For the life of me I cannot understand why this was possibly a good idea, and telling people to use an older version as a workaround... equally as frustrating and stupid.

@StEvUgnIn
Copy link

@JamesAlphonse Feel free Vue and vue-cli for more flexibility. Nuxt can be really confusing for advanced websites, especially if you don't need nuxt modules..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests