manwar / theweeklychallenge

The Weekly Challenge - Perl & Raku. You do not have to be an expert. https://theweeklychallenge.org
Artistic License 2.0
11 stars 19 forks source link

Get the REST API structure defined #125

Open manwar opened 7 months ago

manwar commented 7 months ago

Discuss the needed route for the new REST API to support existing feature and future request.

baimamboukar commented 7 months ago

Hello @manwar 👋

From how things are structured on the website theweeklychallenge.org, I think we need the following routes:

baimamboukar commented 7 months ago

Hi @manwar

Are there other necessary routes that I missed ? Or routes that are not really required on this list?

I would like your feedback. Thanks!

manwar commented 7 months ago

@baimamboukar please add a document explaining each route and its input and output.

manwar commented 7 months ago

@baimamboukar You could check this: https://swagger.io/resources/articles/best-practices-in-api-design/ and https://docs.swagger.io/spec.html

baimamboukar commented 7 months ago

@baimamboukar please add a document explaining each route and its input and output.

Alright @manwar. I'm on it ✨

baimamboukar commented 7 months ago

@baimamboukar You could check this: https://swagger.io/resources/articles/best-practices-in-api-design/

and https://docs.swagger.io/spec.html

Thanks for the ressources @manwar. I really appreciate it 🙏

ayushichoudhary-19 commented 6 months ago

These are some great suggestions by @baimamboukar 👏🏻

@manwar Here are a few additional suggestions that I have considering we'll be having login/signup routes as well:

ayushichoudhary-19 commented 6 months ago

Let me know what you think about this @manwar!

manwar commented 6 months ago

@ayushichoudhary-19 If you are actually coding then think of bigger picture and create library that can be used inside Dancer2 web framework and managed by unit test independently.

baimamboukar commented 6 months ago

These are some great suggestions by @baimamboukar 👏🏻

@manwar Here are a few additional suggestions that I have considering we'll be having login/signup routes as well:

  • We might want to restrict access to certain routes only to logged-in users. We can achieve this by checking the user's session status within those routes and redirecting them to login if not authenticated.
  • The /user route could potentially handle both user creation (signup) and retrieval (login) depending on the POST request data. We can consider separating these functionalities into dedicated /signup and /login routes for better clarity.
  • Additionally, we can also have a /logout route which itself doesn't display anything in the browser but handles the server-side logic of invalidating the user's session. After session invalidation, the user can be redirected to another page either the home page or the login page. We can also maybe add a confirmation page displaying a "successfully logged out" message.

Thanks very much @ayushichoudhary-19 ✨ I have taken note of all these information. I will update what I'm doing accordingly 🫡

baimamboukar commented 6 months ago

@manwar I would like to be assigned this issue, please!

baimamboukar commented 6 months ago

Hello @manwar

This is ready for review https://github.com/ChallengeForge/TheWeeklyChallenge/pull/4