gothinkster / gothinkster/node-express-realworld-example-app

Route.get() requires callback functions but got a [object Undefined]

Open
#40 44 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

I am attempting to recreate this application from scratch. So far I have users controller in place (without the articles, profiles and tags controllers.

However when I try to run the server, I get `Route.get() requires callback functions but got a [object Undefined]` error. If I comment out the `router.get('/user'` and `router.put('/user'` routes, everything works okay and I can register users without problem.

I have been on this for hours. please does anyone know what the problem might be and how to fix it?

Here is complete error message:

```
C:\production apps\backend\node_modules\express\lib\router\route.js:202
throw new Error(msg);
^
Error: Route.get() requires callback functions but got a [object Undefined]
at Route.(anonymous function) [as get] (C:\production apps\backend\node_modules\express\lib\router\route.js:202:15)
at Function.proto.(anonymous function) [as get] (C:\production apps\backend\node_modules\express\lib\router\index.js:510:19)
at Object. (C:\production apps\backend\routes\api\users.js:9:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (C:\production apps\backend\routes\api\index.js:3:17)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! backend@1.0.0 start: `node ./app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the backend@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BenKay\AppData\Roaming\npm-cache\_logs\2017-09-07T13_43_52_191Z-debug.log
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.