Skip to content
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

Restore ApolloServerStandalone functionality #6085

Closed
glasser opened this issue Feb 4, 2022 · 4 comments
Closed

Restore ApolloServerStandalone functionality #6085

glasser opened this issue Feb 4, 2022 · 4 comments
Assignees
Milestone

Comments

@glasser
Copy link
Member

glasser commented Feb 4, 2022

The batteries-included apollo-server package has been deleted from the version-4 branch. Its functionality should be restored as a new class with a different name in the main package, like ApolloServerStandalone or something.

@glasser glasser added this to the Release 4.0 milestone Feb 4, 2022
glasser added a commit that referenced this issue Feb 4, 2022
This functionality will be restored later in the development
of AS4 as a new class with a name like `ApolloServerStandalone`.
Remembering to do that is tracked in #6085.
glasser added a commit that referenced this issue Feb 4, 2022
This functionality will be restored later in the development
of AS4 as a new class with a name like `ApolloServerStandalone`.
Remembering to do that is tracked in #6085.
@glasser
Copy link
Member Author

glasser commented Feb 24, 2022

Some of the cors tests deleted in 81c7f7b will probably be useful for the standalone server.

@glasser
Copy link
Member Author

glasser commented May 6, 2022

@trevor-scheer and I ran into some issues related to generic types and TContext trying to make this a class. My current idea is to make this a function instead (pretty similar to what @abernix originally proposed in #3184 though with a bit more async-ness). This noun-named httpServer is analogous to expressMiddleware.

// or maybe you have to deep-import httpServer to avoid importing `express` otherwise?
// or maybe the `express` import is a runtime import() instead.
import { ApolloServer, httpServer } from '@apollo/server';
const server = new ApolloServer<MyContext>({ typeDefs, resolvers });
await httpServer(server, {
  context: async ({ req, res }) => new MyContext(req),
}).listen(1234);

where httpServer is a function that synchronously returns something like

class ApolloHttpServer {
  async listen(...args): Promise<{url: string}> {
    await this.server.start();
    await promisified-server-listen
  }
}

@glasser
Copy link
Member Author

glasser commented May 12, 2022

@trevor-scheer done?

@trevor-scheer
Copy link
Member

Closed via #6420

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants