BuildForSDG / BuildForSDG/Team-006-Backend

[feature] - Create validation middleware and initial validation rules

Open
#20 2 comments 0 reactions 0 assignees View on GitHub
back-end chore
Dominant language
JavaScript
Stars
2
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### Description

Create an express middleware for validation of all input data to API endpoints using the `hapi/joi` validation package. Create a directory (or a file if not too large) containing various validation rules for existing models (note: more rules will be added over time).

### Resources
https://dev.to/jacqueline/using-hapi-joi-version-16-1-7-to-validate-a-request-body-in-a-restful-api-bje

### Acceptance Criteria

- [ ] 1. Create validation middleware capable of receiving input
- [ ] 2. Create validation rules in a central location, at least for `/api/v1/auth/reporter` endpoints

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing Express API routes and the `/api/v1/auth/reporter` endpoints to identify how request input is currently handled. Read the linked hapi/joi resource before defining the middleware and central validation rules. Done means the middleware accepts endpoint input and the reporter endpoints use initial rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.