FireShort
FireShort copied to clipboard
Implementation of FireShort API and its Documentation
Implement FireShort API and its complete documentation:
- [x] Implement FireShort API
- [x] FireShort API Documentation has been added
- [x] Documented how to setup cloud function (FireShort API) on both cloud and locally
What is the current behavior?
- Same as previous except in the API Section
What is the new behavior?
- A new button added in the Admin dashboard (API Settings)
- A Page has been added (
/admin/settings/api), here I specify all information related to the FireShort API - Added new dependencies
- Added new
README.mdfor How to setup Firebase Cloud Functions
Other information?
It will never conflict with other files, the only files which will affect are Admin.js, App.js, package.json and package-lock.json
because
Thanks for opening this pull request 🎉🎉! Please check out our contributing guidelines and provide us atleast 24 hours to review this PR
Hey @JithinAntony4, looks like you have made an error in your imports in the Settings.js file : "Module not found: Can't resolve 'swagger-ui-react' in '/Users/monish/Downloads/fireshort-master/src/components'" please fix this
@monizb I'm already added swagger-ui-react on package.json make sure that you've installed.
Hey @JithinAntony4 , thanks for this amazing PR 🥳🥳🥳 Very few of the PRs like yours are made in a good spirit for Hactoberfest, I have looked at the UI part and have seen you using Swagger UI for API documentation part, I havent deployed the functions part locally and had a few questions which hopefully you can give me a clarity about:
- How is the API Key being generated?
- What are the steps taken by you on the authentication part of the request
- How would you write the perfect Firestore security rules for the API part?
Also can you please provide a gif showing the API in action so that we can have some clarity, thanks a lot and congragulations once again! 🥳🥳
@JithinAntony4 Some of the errors and Bugs I have noticed by now:
- While testing the APIs I always get this error: TypeError: Failed To Fetch .But When I try to use the API from Postman It seems to be working 4 out of 5 times and sometimes returns the same Failed to Fetch (I have tested only get all URLs API right now
- The Object keys returned are not consistent, some times it returns lurl key first sometime locked key first
- When I try to use the create API route, it does create a new link with the speicifed lurl but the shorturl is empty, also the name key should be optional and when left blank should automatically create the short id as it happens right now.
The 3rd problem seems to happen because you are not setting the 'curl' property in the DB rather you are adding a 'name' property which is not recognised by the app.
Hey @JithinAntony4 , thanks for this amazing PR 🥳🥳🥳 Very few of the PRs like yours are made in a good spirit for Hactoberfest, I have looked at the UI part and have seen you using Swagger UI for API documentation part, I havent deployed the functions part locally and had a few questions which hopefully you can give me a clarity about:
- How is the API Key being generated?
- What are the steps taken by you on the authentication part of the request
- How would you write the perfect Firestore security rules for the API part?
Also can you please provide a gif showing the API in action so that we can have some clarity, thanks a lot and congragulations once again! 🥳🥳
Hey @monizb
- Currently there is only one API Key for the Admin, If keys didn't present, one Key automatically generated using
nanoidand save it. - Accessing API is like
curl -X GET "https://%YOUR_CLOUD_FUNCTION_URL%/v1/url" -H "accept: application/json" -H "api_key: API_KEY"(getting all links / urls)
- While testing the APIs I always get this error: TypeError: Failed To Fetch .But When I try to use the API from Postman It seems to be working 4 out of 5 times and sometimes returns the same Failed to Fetch (I have tested only get all URLs API right now Hey @monizb If you use cloud functions in locally there's a problem with chrome web security in order to get rid restart chrome or chromium with the
--disable-web-securityargument. examplechrome.exe --disable-web-security --user-data-dir="[some directory here]". if you run in locally make sure that scheme should behttp
3. When I try to use the create API route, it does create a new link with the speicifed lurl but the shorturl is empty, also the name key should be optional and when left blank should automatically create the short id as it happens right now.
@monizb This bug is fixed now.
- While testing the APIs I always get this error: TypeError: Failed To Fetch .But When I try to use the API from Postman It seems to be working 4 out of 5 times and sometimes returns the same Failed to Fetch (I have tested only get all URLs API right now Hey @monizb If you use cloud functions in locally there's a problem with chrome web security in order to get rid restart chrome or chromium with the
--disable-web-securityargument. examplechrome.exe --disable-web-security --user-data-dir="[some directory here]". if you run in locally make sure that scheme should behttp
How would a normal user use this without disabling that? I think you need to use cors package to fix that security issue there. Also have you edited the name key to curl?
- While testing the APIs I always get this error: TypeError: Failed To Fetch .But When I try to use the API from Postman It seems to be working 4 out of 5 times and sometimes returns the same Failed to Fetch (I have tested only get all URLs API right now Hey @monizb If you use cloud functions in locally there's a problem with chrome web security in order to get rid restart chrome or chromium with the
--disable-web-securityargument. examplechrome.exe --disable-web-security --user-data-dir="[some directory here]". if you run in locally make sure that scheme should behttpHow would a normal user use this without disabling that? I think you need to use
corspackage to fix that security issue there. Also have you edited the name key to curl?
@monizb cors bug has been fixed
Sider detected 2 errors on analyzing the commit d501f54.
We recommend fixing them as possible by updating the dependencies, configuring the analysis tool, configuring sider.yml, turning off unused tools, and so on.
If you have problems or questions still, feel free to ask us via chat. 💬
You can turn off this notification if you don't want to receive it from now on.
@JithinAntony4 right now Signup Features are being added and the entire DB structure is being changed, so it will take a few days to change this PR and merge it,so I am going to add the hacktoberbest-accepted label so that your review period starts
@JithinAntony4 are you up for changing the API to store the data based on the recent DB structure?
@JithinAntony4 are you up for changing the API to store the data based on the recent DB structure?
@monizb yeah just take a look on it .
@monizb I've resolved the conflict, just a look at it
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This PR seems to have gone stale, adding label accordingly