Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEdsel Talento
16,922 PointsWhat is the difference between posting data with fetch() and Model.create()?
1 Answer
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 PointsHi Edsel,
POSTing is just a way to send data in the form of an XMLHttpRequest object so that you can use/manipulate that data on the other end of the request.
Model.create() is a way to build and save a new instance of your model into a database.
Now while Model.create() may use the data sent via the post request, they aren't interchangeable.
Does that help?
Model.create() is a function used to communicate with an ORM.
A POST request doesn't require you to use a database at all.
Edsel Talento
16,922 PointsEdsel Talento
16,922 PointsHi Brandon,
Thank you for your answering my question, it's more clear now.