Comments (5)
Thanks for the complete bug report, I'll try to reproduce later. This does seems like a server.js bug.
from server.
Hi @AdamCollins, unfortunately I couldn't reproduce the issue and it works fine for me. Could you please put your package.json
and copy/paste the full error? I suspect one of these 3 issues might be happening:
- EJS is not installed (it has to be installed manually) ->
npm install ejs
. This will make the route throw an error, so it will not render anything and so you'll get this issue. - The EJS template is not in the
views
folder, which will make an error similar to the one above. This can be changed with theviews
option if you want. - Your browser is requesting a different resource like
favicon.ico
, which will not be found. To debug this, add an extra route that does this to see if there's any extra request that you are not intending to make:
const server = require("server");
const { get, error } = server.router;
const { render, status } = server.reply;
server([
ctx => {
console.log(ctx.method, ctx.url);
},
get("/", ctx => render("index.ejs"))
]);
There might be some other issue, but these 3 are the ones I'd check for first. I created a repository with working code. Is there anything different from your code?
from server.
BTW I strongly believe it is the 3rd option of the browser asking for a resource that cannot be found, because it's the only one that would account for the situation you are seeing that server(get('/', ctx => ...))
does not work but server(ctx => ...)
works.
from server.
The issue was option 3. After adding the references to the public folder the warning disappears.
Thank you!
from server.
Hey @AdamCollins, so I also went ahead and just published 1.0.19
fixing the issue on server.js side. Now the error message will be much more clear like this:
Your middleware did not return anything for this request:
GET /abc.png
This normally happens when no route was matched or if the router did not reply with anything. Make sure to return something, even if it's a catch-all error.
Documentation for reply: https://serverjs.io/documentation/reply/
Relevant issue: https://github.com/franciscop/server/issues/118
Please feel free to open any other issue you find 😄
from server.
Related Issues (20)
- throw new TypeError('argument res is required') HOT 2
- How to configure socket.io? HOT 5
- TypeScript HOT 1
- Handling file uploads with multipart/form-data POST requests HOT 6
- Upgrading Helmet to the next major version HOT 3
- How to configure https server ? HOT 2
- How to create, set a name and send a file dynamically create HOT 9
- Basic usage example in docs is incorrect HOT 2
- Issues running cookie test code HOT 5
- Bug method POST vs PUT is not working
- How integrat ApolloGraphql use serverjs HOT 1
- Any schedule for migrating to socket.io 4.x? HOT 6
- Heroku wrong IP HOT 2
- Add CORS package to the core HOT 1
- Change csurf to something maintained HOT 1
- Update formidable HOT 1
- [PSA] update to [email protected] for `rediss://` usage
- while trying post method throwing invalid csrfToken error - how to resolve this HOT 2
- Is it possible to enable pre-flight requests ? HOT 3
- Real time chat with server in a different IP address HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from server.