-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webapp/Express framework support #12
Comments
Hi there, apologies for the long delay. The Koa framework works by essentially wrapping the underlying Node.js
The biggest difference between operating on the raw
To extend this library for use in other frameworks, it'd involve refactoring all the uses of A) operate on the raw Option B is probably preferable since we'd then be able to pass arbitrary information throughout the library, basically emulating the Koa context state behavior. |
I would really like to use this package and I'll look into how to separate the HTTP framework specific stuff from the "core" functionality. When the "core" has a clear API it would be easier to create glue code for different HTTP frameworks. EDIT: So I have noticed that the koa ctx is used consistently throughout the codebase. This might make it possible to stub that instance and have that interact with express equivalents. These are ctx properties I have found in the codebase. Not all require stubbing. ctx.body
ctx.get
ctx.method.toLowerCase
ctx.redirect
ctx.req
ctx.request.body
ctx.request.ical
ctx.request.type
ctx.request.type.includes
ctx.request.xml
ctx.request.xml.documentElement.localName
ctx.response.set
ctx.set
ctx.state.caldav
ctx.state.calendarHomeUrl
ctx.state.calendarUrl
ctx.state.params
ctx.state.params.calendarId
ctx.state.params.eventId
ctx.state.params.principalId
ctx.state.principalRootUrl
ctx.state.principalUrl
ctx.state.user
ctx.state.user.principalId
ctx.state.user.principalName
ctx.status
ctx.url
ctx.url.match
ctx.url.toLowerCase Another idea is to spawn a process with a certain port number and proxy the requests in express to that localhost process. Might be less work to get that working. |
Regarding the Future bullet you have in the README:
I'm looking to integrate CalDAV into a Meteor server, which uses the webapp framework. I believe webapp was the basis for Express and they're mostly compatible, but I'm not familiar with Koa.
Do you have a sense of how difficult it would be to port? I assume it's mostly
src/koa.js
that needs to change. I've only taken a quick look, but it looks fairly straightforward. For example:would probably change to
The text was updated successfully, but these errors were encountered: