You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Increase default body-parser limit for standalone server (#7172)
In `apollo-server` (v3 standalone equivalent), the default limit for the
`body-parser` package was `50mb`. This restores the previous limit
and adds a test to confirm it remains at least > the default (100KiB).
<!--
First, 🌠 thank you 🌠 for taking the time to consider a contribution to
Apollo!
Here are some important details to follow:
* ⏰ Your time is important
To save your precious time, if the contribution you are making will take
more
than an hour, please make sure it has been discussed in an issue first.
This is especially true for feature requests!
* 💡 Features
Feature requests can be created and discussed within a GitHub Issue. Be
sure to search for existing feature requests (and related issues!) prior
to
opening a new request. If an existing issue covers the need, please
upvote
that issue by using the 👍 emote, rather than opening a new issue.
* 🔌 Integrations
Apollo Server has many web-framework integrations including Express,
Koa,
Hapi and more. When adding a new feature, or fixing a bug, please take a
peak and see if other integrations are also affected. In most cases, the
fix can be applied to the other frameworks as well. Please note that,
since new web-frameworks have a high maintenance cost, pull-requests for
new web-frameworks should be discussed with a project maintainer first.
* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.
* 📖 Contribution guidelines
Follow
https://github.com/apollographql/apollo-server/blob/main/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
tests for all new behavior.
* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
your
pull request is meant to accomplish. Provide 🔗 links 🔗 to associated
issues!
We hope you will find this to be a positive experience! Open source
contribution can be intimidating and we hope to alleviate that pain as
much as possible. Without following these guidelines, you may be missing
context that can help you succeed with your contribution, which is why
we encourage discussion first. Ultimately, there is no guarantee that we
will be able to merge your pull-request, but by following these
guidelines we can try to avoid disappointment.
-->
Co-authored-by: David Glasser <[email protected]>
Copy file name to clipboardExpand all lines: docs/source/api/standalone.mdx
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ This API reference documents the `startStandaloneServer` function.
9
9
10
10
## Overview
11
11
12
-
This `startStandaloneServer` function helps you get started with Apollo Server quickly. This function is recommended for all projects that don't require serverless support or a particular Node.js framework (such as Fastify). Under the hood, the `startStandaloneServer` function uses Apollo Server 4's Express integration (i.e., [`expressMiddleware`](./express-middleware)).
12
+
This `startStandaloneServer` function helps you get started with Apollo Server quickly. This function is recommended for all projects that don't require serverless support or a particular Node.js framework (such as Fastify). Under the hood, the `startStandaloneServer` function uses Apollo Server 4's Express integration (i.e., [`expressMiddleware`](./express-middleware)).
13
13
14
14
Because it sets helpful defaults, this function is less configurable than other Apollo Server integrations. Complex projects might eventually need to [swap to using `expressMiddleware`](#swapping-to-expressmiddleware) (this process is straightforward).
15
15
@@ -30,7 +30,7 @@ const server = new ApolloServer({ typeDefs, resolvers });
30
30
// `startStandaloneServer` returns a `Promise` with the
@@ -59,7 +59,7 @@ The `startStandaloneServer` function's second optional argument is an object for
59
59
60
60
<td>
61
61
62
-
An optional asynchronous [`context` initialization function](../data/resolvers#the-context-argument).
62
+
An optional asynchronous [`context` initialization function](../data/resolvers#the-context-argument).
63
63
64
64
The `context` function should return an object that all your server's resolvers share during an operation's execution. This enables resolvers to share helpful context values, such as a database connection.
65
65
@@ -91,7 +91,7 @@ If no `port` is specified, this defaults to using `{port: 4000}`.
91
91
</tbody>
92
92
</table>
93
93
94
-
### Example
94
+
### Example
95
95
96
96
Below is a full example of setting up `startStandaloneServer`:
97
97
@@ -196,7 +196,8 @@ await server.start();
196
196
// and our expressMiddleware function.
197
197
app.use('/',
198
198
cors<cors.CorsRequest>(),
199
-
bodyParser.json(),
199
+
// 50mb is the limit that `startStandaloneServer` uses, but you may configure this to suit your needs
200
+
bodyParser.json({ limit: '50mb' }),
200
201
// expressMiddleware accepts the same arguments:
201
202
// an Apollo Server instance and optional configuration options
0 commit comments