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 trial

JavaScript

How would I go about using an API that isn't mine and a DB that is mine at the same time?

I don't even know if that question makes sense, so I'm just going to explain my idea real quick:

Came across the Marvel API and my idea was to make a "who wins" - "app" that fetches two random superheros from the api and let's the user decide which one would win in a fight between those two.

Now I'm pretty sure I know how to make the calls to the API and store and display the response correctly, but obviously I would also want to store how often which hero won/lost and against whom.

So where/how would I store that data? I clearly can't POST back to the Marvel API, so do I need to set up a database on my own? And if so, how would I bind the data from my DB to the correct hero (I'm guessing a front-end framewor that offers databinding?)?

Any insight would be appreciated.

4 Answers

I would create a MEAN app.

  • M - Mongo DB. For storing the data
  • E - Express. A web development framework for Node.
  • A - Angular front end framework
  • N - Node.

Here is a decent example

Yes, I thought so (I have done completed the full-stack JS path). I was just wondering if was thinking in the right direction or not, but it seems so. Thanks for the reply!

Also - here is a node-wrapper for the marvel API

https://www.npmjs.com/package/marvel-api

Neat, thanks!