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

Server-Side Data #61

Closed
knpwrs opened this issue Dec 12, 2016 · 7 comments
Closed

Server-Side Data #61

knpwrs opened this issue Dec 12, 2016 · 7 comments
Labels

Comments

@knpwrs
Copy link

knpwrs commented Dec 12, 2016

As it stands today, is there a good way to connect to a server-side database and render pages that work without JavaScript on the client, but can progressively enhance to use JavaScript on the client if available? Essentially that would mean not exposing a rest API, but instead having some sort of data provider mechanism that doesn't leak secrets to the client.

This question is available on Nuxt.js community (#c50)
@Atinux
Copy link
Member

Atinux commented Dec 12, 2016

Hi @knpwrs

Actually, Nuxt.js already render a page that can work without the JS on the client-side (because it's server-renderer).

For connecting to a server-side database, I would not recommend it because when navigating in the client-side, your page will have to render the data as well and since you want to protect it for only the server-side, it won't work.

Nuxt.js is made to create web-application based on API so the API call (http request from the server-side or ajax request on the client-side) will work for both environments.

@knpwrs
Copy link
Author

knpwrs commented Dec 12, 2016

Unfortunately the API call won't work for a client without JavaScript which kinda makes server-side rendering moot except for the point of getting a fast initial render.

@knpwrs knpwrs closed this as completed Dec 12, 2016
@Atinux
Copy link
Member

Atinux commented Dec 12, 2016

@knpwrs if the client does not have JavaScript, it will reload the page, and you can use axios to make API call from the server-side as well.

@Mirodil
Copy link

Mirodil commented Jan 16, 2017

Is it possible load data to nuxt.js without creating additional http request from server-side, and send rendered html page to client?

@Atinux
Copy link
Member

Atinux commented Jan 17, 2017

@Mirodil please take a look at this answer I wrote: #123 (comment)

@Mirodil
Copy link

Mirodil commented Jan 17, 2017

Thanks, from client side it works and looks perfect, but server side part bit odd.

@lock
Copy link

lock bot commented Nov 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 5, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants