DEV Community

Discussion on: Node backend and api calls same project

Collapse
 
scriptmunkee profile image
Ken Simeon

Hi D0xzen,

I'm new in to the NodeJS/Express space, but would like to help. I've figure out most basic dynamics of building an API/Route backend and displaying the data in a web front end within the same code base.

So, for me or others to help we need a bit more context around what you're trying to do. Can you provide a code sample of where you're stuck at? Or can maybe provide some specifics around what you're trying to build?

Cheers!
Ken

Collapse
 
d0xzen profile image
D0xzen • Edited

Hi Ken S Thanks for replying,

I made a backend application with express with all routes i can navigate in my home page where i view all posts that users have posted.

What i want to do right now is to add the like button and upon clicking it making an API call let's suppose /like/:postId and updating the post like numbers with the json response.

The same with comments i want to inside the post detail and get all comment upon clicking the view more button so the same calling /postComment/:postId and getting back all comments and with javascript replacing it inside the DOM without refreshing.

The thing that i found problematic was where i put my API's calls... right now i found an open source project: github.com/dan-divy/spruce where he puts the calls inside the route/api folder

I hope that i'm clear :)