What am I doing wrong?
See original GitHub issueI have a gulp task that uses webpack to package up my client-side code and puts it into the file [app_root]/build/public/bundle.js
My Koa server is also babel transpiled and then placed into [app_root]/build/index.js
Then I’m trying the following in my app:
import staticServe from 'koa-static'
import koa from 'koa'
let app = koa()
app.use(staticServe('public'))
And I keep getting the following error whenever I try to load my page and it tries to request the bundle.js
file:
BadRequestError: Invalid Request
.
.
at Object.serve (/Users/mmarcus/WebstormProjects/Fanatics-3C/3c-middleware/node_modules/koa-static/index.js:41:14)
For the time being, I’ve gotten things to work with the following, but it’s obviously a hack and breaks koa’s handling of 404’s for requests to the /public
folder, giving me TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
…
app.use(function* (next) {
if (this.request.path.indexOf('/public') === 0) {
yield staticServe(`${__dirname}`)
} else {
yield next
}
})
Please help?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
I feel stuck in life, what am I doing wrong? - Quora
Coming to the point, what you are doing wrong can be best judged by you. I am feeling lonely and depressed. I am...
Read more >Ep #142: Finding the Answer: What Am I Doing Wrong?
I'm sharing how to talk to any shame you're experiencing, and how to define success, failure, and everything in between.
Read more >What Am I Doing Wrong? - Troubleshoot Your Dating Life for ...
Ever wonder, “What Am I Doing Wrong?” when it comes to dating and love. Find out how you can improve your dating and...
Read more >What am I doing wrong? : r/socialskills - Reddit
What am I doing wrong ? Hello everybody. First, I just wanted to say 'hi' to ...
Read more >"What am I doing wrong in my relationship": 13 most common ...
“What am I doing wrong in my relationship”: 13 most common mistakes. We sometimes include products we think are useful for our readers....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closed due to inactivity!
Guess I’ll just tackle this myself then…