API fails if the `SERVER_PORT` variable is not in the `.env` file
Describe the bug
API fails if the SERVER_PORT variable is not in the .env file
To Reproduce Steps to reproduce the behavior:
- Remove the SERVER_PORT variable from the
.envfile - Start the API
- Errors are seen
Expected behavior
- The API should default to a SERVER_PORT if the variable is not in the
.envfile - We need valid passing tests created to make sure that this is not repeated
Actual behavior
- See above
Screenshots
Additional details
The feature was added in this PR, but this edge case was not considered
- https://github.com/PalisadoesFoundation/talawa-api/issues/2259
Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship https://github.com/PalisadoesFoundation/talawa/issues/359
@NamitBhutani If you have the time, you may want to take a look at this.
@NamitBhutani If you have the time, you may want to take a look at this.
Although I tested this case, I'll take a look again.
Hey @palisadoes, I am thinking of fixing this issue, can you please assign it to me?
@TARishabh If the issue has already been assigned, please don't ask to be assigned. We want everyone to get a chance.
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
- Inactive, unassigning
- Are you still working on this?
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
@palisadoes I have come up with a solution, can you please assign the issue to me?
@Cioppolo14 I would really like to work on this issue.
@Suyash878 How are you planning to solve this issue? If we have a clear plan then we are ready to go solve this issue easily
@varshith257 I was planning on running one final check in the src/index.ts file using the isNaN() function to get to know about the nature of the port if in case it is undefined, and if it returns undefined then switching the port to 4000.
The code snippet looks something like this:
Terminal snippet:
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.