diegohaz / diegohaz/rest

Running npm run dev is showing `TypeError: app.use() requires middleware functions`

Open
#82 0 comments 0 reactions 0 assignees View on GitHub
bug can't reproduce
Dominant language
JavaScript
Stars
1.8k
Forks
304
PR merge metrics
No merged PRs in 30d

Description

@diegohaz After i setuped a project using yo rest and when i run `npm run dev` it is showing the following error
`/Users/rajkannanbalu/Documents/ulavarsanthai/webservices/node_modules/express/lib/application.js:210
throw new TypeError('app.use() requires middleware functions');
^

TypeError: app.use() requires middleware functions
at EventEmitter.use (/Users/rajkannanbalu/Documents/ulavarsanthai/webservices/node_modules/express/lib/application.js:210:11)
at exports.default (/Users/rajkannanbalu/Documents/ulavarsanthai/webservices/src/services/express/index.js:33:7)
at Object. (/Users/rajkannanbalu/Documents/ulavarsanthai/webservices/src/app.js:7:13)
at Module._compile (module.js:570:32)
`

Looks like some setup need for middleware in express 4.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running `npm run dev` and inspect `src/services/express/index.js` at line 33, where the stack trace shows `app.use()` failing; then check how that service is initialized from `src/app.js` line 7. Done means the generated project starts without the middleware-function TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.