Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pdehaan/express-celebrate
Messing around with express and celebrate modules.
https://github.com/pdehaan/express-celebrate
Last synced: 22 days ago
JSON representation
Messing around with express and celebrate modules.
- Host: GitHub
- URL: https://github.com/pdehaan/express-celebrate
- Owner: pdehaan
- Created: 2020-01-21T15:57:56.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T11:44:59.000Z (almost 2 years ago)
- Last Synced: 2024-12-19T15:07:04.941Z (about 1 month ago)
- Language: JavaScript
- Size: 430 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Express + Celebrate test
Messing around with [**celebrate**](https://www.npmjs.com/package/celebrate), "an express middleware function that wraps the joi validation library".
```sh
npm start
# Server is started... http://localhost:3000/
```URLs to test:
1.
OUTPUT: `Hello, {"name":"stranger}`
2.
OUTPUT: `Hello, {"name":"foo"}`
3.
OUTPUT: `Hello, {"name":"foo","age":33}`
4.
OUTPUT: `{"statusCode":400,"error":"Bad Request","message":"\"age\" must be a number","validation":{"source":"query","keys":["age"]}}`
5.
OUTPUT: `{"statusCode":400,"error":"Bad Request","message":"\"status\" is not allowed","validation":{"source":"query","keys":["status"]}}`
6.
OUTPUT: `/name is, "foo"`
7.
OUTPUT: `{"statusCode":400,"error":"Bad Request","message":"\"name\" is required","validation":{"source":"query","keys":["name"]}}`