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

Server-side validation #126

Open
swbloom opened this issue Jul 19, 2017 · 2 comments
Open

Server-side validation #126

swbloom opened this issue Jul 19, 2017 · 2 comments

Comments

@swbloom
Copy link
Contributor

swbloom commented Jul 19, 2017

Currently, the API will let you create new documents that receive request bodies that are malformed (missing payload data, IDs pointing to instructors that don't exist).

The API should validate requests and reject improperly formatted ones.

@swbloom
Copy link
Contributor Author

swbloom commented Jul 20, 2017

I was looking at different validation strategies for express, and it looks like validation middleware is a common pattern for ensuring properly formatted requests. @Rchristiani what do you think of something like this: https://www.npmjs.com/package/express-validator

My concerns about it is that it might make a lot of our tests fail (though maybe that's a good thing?)

I can put together a proof of concept on a branch if you think it's something worth exploring

@Rchristiani
Copy link

Will look into it, but it probably makes more sense to do it via Mongoose http://mongoosejs.com/docs/validation.html

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

No branches or pull requests

2 participants