Does anyone know of a framework that can help to structure and organize server responses from API endpoints (built on Netlify’s lambda functions, of course), that encodes current best practices, particularly around headers?
If I look at “node server” frameworks, they all want to run the server, which given the almighty Netlify, we don’t need. I’m envisioning helper functions that can help me deal in a methodical way with, say CORS, Authentication headers, Origin headers, Vary, OPTION methods, Set-Cookie, ETags, so on and so forth. I’m not above writing it myself, but I don’t want to reinvent that particular wheel, if someone has open-sourced their expertise on it
The project is a minimal, no-tracking comment system (open-source, you can see it here https://github.com/rendall/simple-comment). Currently there is a “Service” class that exposes methods like
topicGET, and all tests pass, returning appropriate responses for everything. Now I just need to wire them up to the Netlify endpoints
For anyone who finds this and thinks “that’s me too!”, I haven’t found anything specific yet, but I did find this: https://functions.netlify.com/examples It may be an obvious reference when you read this, but it is new to me now
I’m going through it and there is a wealth of ideas in there, including this validateHttpMethod which, as a simple method validator is a great model for creating other helpers.
Incidentally, if any moderators see this, I’d like to let you know that the link from the examples page lambda-jwt-auth “An auth service powered by lambda functions & MongoDB” points to a broken link. I did find lambda-jwt-auth-demo by searching GitHub, though.
Hi @rendall, looks like that link is defined here: https://github.com/netlify-labs/functions-site/blob/master/data/examples.json#L481
Would you willing to propose that change on that repo?
I finally carved out some time to update this project and discovered that the repo is archived / read only. I’m happy to make that change, though. Let me know if the project becomes unarchived.
hey there, it looks like we had duplicate repos and so one was archived.
is the change needed here?
we’d accept PRs on that for sure.
Not sure. There was a 1:1 mapping between the broken link and the other github project, but these seem to be updated and curated. Let’s “close” this for now, but revisit if there’s a need.