SiegeEngineers / aoe2cm2

Captains Mode for Age of Empires II
https://aoe2cm.net
51 stars 25 forks source link

added api to footer #63

Closed johannes4998 closed 3 years ago

johannes4998 commented 3 years ago

As discussed in SE Discord i try to add an API description to aoe2cm2. add a file API.tsx with the content add a route on index.tsx to /API and add a link in the footer

HSZemi commented 3 years ago

Thank you for tackling this. Is there a reason to not list all app.post and app.get paths from https://github.com/SiegeEngineers/aoe2cm2/blob/master/src/DraftServer.ts?

johannes4998 commented 3 years ago

No, im really new to this and dont know best practices. But when i look into DraftServer.ts, it seems like this handles the api calls. In my mind the change is just a static page with information about the api

HSZemi commented 3 years ago

No worries! I would say it makes sense to list all available api endpoints and methods in an api reference page.

Ideally, such a page would be generated automatically, but I researched that briefly and it seems to be nontrivial to turn these express routes into an api documentation automatically. Therefore I suggest to go with a manually written static page for now, as your draft implements it.

If you could update your pull request to include documentation for all 8 api calls, that would be lovely. If you are unsure about what a specific one is for, feel free to ask.

johannes4998 commented 3 years ago

Ah, i didnt know there are more but i see them in DraftServer. Yes, i will include them too.

johannes4998 commented 3 years ago

I added all api calls. But i would need help with the parameters for add draft/preset and alerts.

HSZemi commented 3 years ago

@johannes4998 what do you think about https://github.com/SiegeEngineers/aoe2cm2/commit/09e4099289d0a2f67c715ca92aa506566dc88223?

HSZemi commented 3 years ago

Added in 09e4099289d0a2f67c715ca92aa506566dc88223. Thanks for your work!