Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Add support for APIs #117

Merged
merged 2 commits into from
Aug 14, 2019
Merged

Add support for APIs #117

merged 2 commits into from
Aug 14, 2019

Conversation

Deadleg
Copy link
Contributor

@Deadleg Deadleg commented Aug 8, 2019

There are only a few minor issues with the current implementation to
get this going, namely:

  • Allowing POST, PATCH etc. in Cloudfront.
  • Checking if the NextJS page is a React component or not.

The change to compatLayer.js is needed so that if a request without
a body is sent to an API the Stream still has some content. Without
a _read() is not implemented is raised which generates an HTTP 400
response without a body.

The stream test case is removed since the stream already has EOF pushed
to it. Don't think there is a use case where the input is a stream
itself.

#116

@mattdell
Copy link
Contributor

Will this work for Dynamic API routes?

For example...

GET /api/blog/[blogId]/comments/[commentId]

@Deadleg
Copy link
Contributor Author

Deadleg commented Aug 12, 2019

Good question, not in this change but I can't see why it wouldn't after #99 is merged. I'll test with that pull request in the next couple of days since I've only used it with static API paths so far.

Deadleg and others added 2 commits August 14, 2019 13:46
There are only a few minor issues with the current implementation to
get this going, namely:

- Allowing POST, PATCH etc. in Cloudfront.
- Checking if the NextJS page is a React component or not.

The change to `compatLayer.js` is needed so that if a request without
a body is sent to an API the Stream still has some content. Without
a `_read() is not implemented` is raised which generates an HTTP 400
response without a body.

The stream test case is removed since the stream already has EOF pushed
to it. Don't think there is a use case where the input is a stream
itself.

#116
@danielcondemarin
Copy link
Contributor

Looks great! Thanks 🙏

@danielcondemarin danielcondemarin merged commit fe618a7 into serverless-nextjs:master Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants