This is my completed solution for a nodejs coding challenge, listed below is the objectives of the challenge
The webapp should display a form for children to enter their id and a free text message to santa.
When submitting the form, the server should check:
- that the child is registered
- that the child is less than 10 years old. To this purpose, the server can fetch user and profiles data in JSON format from:
- https://raw.githubusercontent.com/alj-devops/santa-data/master/userProfiles.json
- https://raw.githubusercontent.com/alj-devops/santa-data/master/users.json
If the child is not registered (no match for the user id) or more than 10years old, the webapp should display a basic error page with an error message explaining the problem.
If the child is registered and less than 10 years old, the server should show a page indicating that the request has been received.
Every 15seconds, the server should send an email with information on all pending (not yet sent) requests including:
- child username (eg. charlie.brown)
- child's address (eg. 219-1130, Ikanikeisaiganaibaai, Musashino-shi, Tokyo)
- request free text as was input in the form
Email sender should be set as [email protected], and sent to [email protected]