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

Working with Body Request Params (req.body) #24

Closed
bernardocs opened this issue Nov 29, 2016 · 5 comments
Closed

Working with Body Request Params (req.body) #24

bernardocs opened this issue Nov 29, 2016 · 5 comments

Comments

@bernardocs
Copy link

bernardocs commented Nov 29, 2016

Hey guys... it's me (again)... 😆

I've been wondering on how do I, for example, receive a JSON from a POST request and put it on the request chain, in a way that I can access via some Vue component.

Is that possible?

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

atinux commented Nov 29, 2016

Hi @bernardocs

You can use express to create your server and use Nuxt.js to render the routes, this way, you can include the body-parser module to let you handle POST request for you application.

Then, you will be able to access req.body from the server-side in your data method.

Example: https://hyperdev.com/#!/project/nuxt-body-params
Live demo: https://nuxt-body-params.hyperdev.space/

You can also call the url with Postman for example and a JSON object:

Imgur

@atinux atinux closed this as completed Nov 29, 2016
@atinux atinux changed the title Working with Request Params Working with Body Request Params (req.body) Nov 29, 2016
@david-j-davis
Copy link

@atinux is this still the preferred method that you suggest to handle post requests?

@ghost
Copy link

ghost commented Sep 24, 2018

This question has been resolved by @Atinux, see answer.

@ghost ghost added the cmty:status:resolved label Sep 24, 2018
@atinux
Copy link
Member

atinux commented Sep 24, 2018

@david-j-davis you can also use serverMiddleware

@lock
Copy link

lock bot commented Oct 31, 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 Oct 31, 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.
Projects
None yet
Development

No branches or pull requests

4 participants