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

Add new endpoint for adding two numbers #19

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Add new endpoint for adding two numbers #19

merged 1 commit into from
Jul 2, 2024

Conversation

akbast
Copy link
Owner

@akbast akbast commented Jul 2, 2024

Related to #18

Adds a new POST endpoint /addNumbers to the server for adding two numbers and returning the sum in a JSON response.

  • Implements express.json() middleware to parse incoming request bodies, enabling the server to handle JSON data.
  • Validates that both inputs in the /addNumbers endpoint are numbers, returning a 400 status code with an error message if validation fails.
  • Calculates the sum of the two validated numbers and returns it in a JSON response.

For more details, open the Copilot Workspace session.

@akbast akbast merged commit dc0ec42 into main Jul 2, 2024
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.

1 participant