Cannot generate authTokens cannot access http://localhost:9000/api/auth

Authentication and Authorization part 4- Authentication API cannot generate authTokens

http://localhost:9000/api/auth is not reachable error Cannot GET /api/auth. can only access http://localhost:9000/api/listings successfully through the backend.

When I try to post via POSTMAN

{

"email":"[email protected]",

“password”: “12345”

}

as a raw JSON to http://localhost:9000/api/auth

I get an error TypeError: schema.validate is not a function
at /Users/gerardocianciulli/Documents/done-with-it/backend/middleware/validation.js:4:25
at Layer.handle [as handle_request] (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/route.js:149:13)
at Route.dispatch (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/route.js:119:3)
at Layer.handle [as handle_request] (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/layer.js:95:5)
at /Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/index.js:284:15
at router.process_params (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/index.js:346:12)
at next (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/index.js:280:10)
at router.handle (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/index.js:175:3)
at router (/Users/gerardocianciulli/Documents/done-with-it/backend/node_modules/express/lib/router/index.js:47:12)

Cannot GET /api/authis expected if that route only definesrouter.post(‘/’); test it with POST, not by opening the URL in a browser. The TypeError is separate: validateis receiving something that isn’t a Joi schema. Check the auth route’s import and the schema file’s export match, and pass the schema itself to the middleware, e.g.validate(authSchema). Also make sure the JSON uses straight quotes and Content-Type: application/json`.