Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readMembers and registerMember functions added. #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

xlight05
Copy link

@xlight05 xlight05 commented Oct 28, 2017

Updated jsonRW file with readMembers function which returns all the member objects as an array and added registerMember function with the ability to add members to the json file. #3
Added basic express calls to index and require all the modules in index.
Added post Endpoint for /api/v1/members/register. #1

Updated jsonRW file with readMembers function which returns all the member objects as an array and added registerMember function with the ability to add members to the json file.
Added register member post route.
Copy link
Contributor

@damianperera damianperera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommended solution would be to have two generalized functions only (ex: readJSON and writeJSON). A good practice in modifying external files is to read the file, store it in a variable, modify the necessary values and then write it back out.

In the server-client environment that NodeJS is normally used in, it is recommended to implement async so that the JSON R/W module executes one operation at a time in a queue, in order to prevent data loss or duplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants