Open Dujota opened 8 months ago
the parameter here also feels like an anti-pattern.
so im assuming you are trying to tie the particular posts comment. ie: get the comments for a given post. This is done through routing itself using RESTfull conventions.
/api/posts/:id/comments
https://github.com/Nimsey/ProjectBlog/blob/d9d4a991b50ed5f46f71e79e01f01fba37b73014/src/components/comments/comments.js#L32
Don't use the domain of the host hardcoded in any code, this is considered a code smell.
Always setup an env variable if the host in CORS. If the host is same site origin, then there is no need, just call /route. This is standard HTTP practice