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 Build a REST API With Express Completing and Testing the API Next Steps

David Lloyd
David Lloyd
2,800 Points

Hello there, I need assistance connecting my API to my client.

I built a client side app and need to connect it to the API that I built while watching this course. Im not able to see how to do that. Do I add a script tag with the port that connects the files and if so how do I go about doing so?

Thanks!!

Dave

1 Answer

hey David, excellent question. Well to connect your back-end API to the front-end of your application, you need to send Ajax calls to the API endpoints. for example, if you want to get all the questions, you would send GET Ajax call from the front-end of your application to the back-end API. And when the API responds back with the data, your front-end application would display it properly. I would recommend you watch the treehouse ajax course as it goes in-depth for that matter.