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 trialpolentz
Full Stack JavaScript Techdegree Student 11,755 PointsA bit confused about what side we are working at...
So, we are learning that node is a runtime environment to run JS outside of the browser, and that allows developers to create server-side application. I am a bit confused now about this application printing on console information received from the treehouse API. Is this considered a client side or server side? In other words, are we coding from the point of view of a server or a client? I understand that we are not in the browser anymore (at the moment), but is this considered server to server communication (our server to treehouse's server)? or are we still acting as clients and the treehouse API is the server?
Thanks in advance
polentz
Full Stack JavaScript Techdegree Student 11,755 Pointsthanks for your response. It is still not clear to me who is the client in this context. Thanks
3 Answers
Steven Parker
231,275 PointsAnything you develop in node.js is server-side relative to your browser. But you're right that this code performs as a client relative to the the treehouse API. So this code is effectively both, but from different perspectives.
Treehouse API (server) (client) node.js program (server) (client) your browser
Steven Parker
231,275 PointsI forgot that this project was a command-line app. So a revised diagram:
Treehouse API (server) (client) node.js program Workspace (server) (client) your browser
polentz
Full Stack JavaScript Techdegree Student 11,755 PointsSteven Parker, thanks. That's very clear now :) So, in this context we are developing a command line app, the terminal would be the client? Thanks for your response
Steven Parker
231,275 PointsIn a sense, mostly because you're using a web browser, but it's the workspace and not the app that's the server. I added a revised diagram to my answer.
polentz
Full Stack JavaScript Techdegree Student 11,755 PointsSounds super clear now! Thanks immensely
Namubiru Ephrance
836 PointsNamubiru Ephrance
836 PointsYou are writing code where all most all its doing is happening at the server. The client is only getting the response after their request. In future if you are to build an app for the end-user lets say in the context of the information being returned by the treehouse API, you will have to interact with a frontend developers interface and grab the user input so that you pass it to your code that's communicating with the server and return the response that's then grabbed by the browser passed through the different styling of the Front End Developer to look simple for the end-user. They won't even know what happened back there. So you are on the serverside