Gathering detailed insights and metrics for @apollo/cache-control-types
Gathering detailed insights and metrics for @apollo/cache-control-types
Gathering detailed insights and metrics for @apollo/cache-control-types
Gathering detailed insights and metrics for @apollo/cache-control-types
@apollo/server-gateway-interface
Interface used to connect Apollo Gateway to Apollo Server
apollo-cache-inmemory
Core abstract of Caching layer for Apollo Client
apollo3-cache-persist
Simple persistence for all Apollo cache implementations
@nerdwallet/apollo-cache-policies
An extension to the InMemoryCache from Apollo that adds additional cache policies.
🌍 Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
npm install @apollo/cache-control-types
@apollo/server@4.11.2
Published on 29 Oct 2024
@apollo/server-integration-testsuite@4.11.2
Published on 29 Oct 2024
@apollo/server@4.11.1
Published on 29 Oct 2024
@apollo/server-integration-testsuite@4.11.1
Published on 29 Oct 2024
@apollo/server@4.11.0
Published on 08 Aug 2024
@apollo/server-integration-testsuite@4.11.0
Published on 08 Aug 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
13,805 Stars
8,411 Commits
2,029 Forks
204 Watching
88 Branches
575 Contributors
Updated on 27 Nov 2024
TypeScript (55.93%)
JavaScript (43.61%)
Shell (0.45%)
Cumulative downloads
Total Downloads
Last day
-0.9%
233,235
Compared to previous day
Last week
5.4%
1,233,272
Compared to previous week
Last month
10.1%
5,143,564
Compared to previous month
Last year
58.1%
53,302,953
Compared to previous year
1
@apollo/server
This
@apollo/server
package is new with Apollo Server 4. Previous major versions of Apollo Server used a set of package names starting withapollo-server
, such asapollo-server
,apollo-server-express
,apollo-server-core
, etc.
Announcement:
Join 1000+ engineers at GraphQL Summit for talks, workshops, and office hours, Oct 8-10 in NYC. Get your pass here ->
Apollo Server is an open-source, spec-compliant GraphQL server that's compatible with any GraphQL client, including Apollo Client. It's the best way to build a production-ready, self-documenting GraphQL API that can use data from any source.
You can use Apollo Server as:
Apollo Server provides a simple API for integrating with any Node.js web framework or serverless environment. The @apollo/server
package itself ships with a minimally-configurable, standalone web server which handles CORS and body parsing out of the box. Integrations with other environments are community-maintained.
Apollo Server provides:
Full documentation for Apollo Server is available on our documentation site. This README shows the basics of getting a server running (both standalone and with Express), but most features are only documented on our docs site.
You can also check out the getting started guide in the Apollo Server docs for more details, including examples in both TypeScript and JavaScript.
Apollo Server's standalone server lets you get a GraphQL server up and running quickly without needing to set up an HTTP server yourself. It allows all the same configuration of GraphQL logic as the Express integration, but does not provide the ability to make fine-grained tweaks to the HTTP-specific behavior of your server.
First, install Apollo Server and the JavaScript implementation of the core GraphQL algorithms:
npm install @apollo/server graphql
Then, write the following to server.mjs
. (By using the .mjs
extension, Node lets you use the await
keyword at the top level.)
1import { ApolloServer } from '@apollo/server'; 2import { startStandaloneServer } from '@apollo/server/standalone'; 3 4// The GraphQL schema 5const typeDefs = `#graphql 6 type Query { 7 hello: String 8 } 9`; 10 11// A map of functions which return data for the schema. 12const resolvers = { 13 Query: { 14 hello: () => 'world', 15 }, 16}; 17 18const server = new ApolloServer({ 19 typeDefs, 20 resolvers, 21}); 22 23const { url } = await startStandaloneServer(server); 24console.log(`🚀 Server ready at ${url}`);
Now run your server with:
node server.mjs
Open the URL it prints in a web browser. It will show Apollo Sandbox, a web-based tool for running GraphQL operations. Try running the operation query { hello }
!
Apollo Server's built-in Express middleware lets you run your GraphQL server as part of an app built with Express, the most popular web framework for Node.
First, install Apollo Server, the JavaScript implementation of the core GraphQL algorithms, Express, and two common Express middleware packages:
npm install @apollo/server graphql express cors body-parser
If using Typescript you may also need to install additional type declaration packages as development dependencies to avoid common errors when importing the above packages (i.e. Could not find a declaration file for module 'cors
'):
npm install --save-dev @types/cors @types/express @types/body-parser
Then, write the following to server.mjs
. (By using the .mjs
extension, Node lets you use the await
keyword at the top level.)
1import { ApolloServer } from '@apollo/server'; 2import { expressMiddleware } from '@apollo/server/express4'; 3import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer' 4import express from 'express'; 5import http from 'http'; 6import cors from 'cors'; 7import bodyParser from 'body-parser'; 8 9// The GraphQL schema 10const typeDefs = `#graphql 11 type Query { 12 hello: String 13 } 14`; 15 16// A map of functions which return data for the schema. 17const resolvers = { 18 Query: { 19 hello: () => 'world', 20 }, 21}; 22 23const app = express(); 24const httpServer = http.createServer(app); 25 26// Set up Apollo Server 27const server = new ApolloServer({ 28 typeDefs, 29 resolvers, 30 plugins: [ApolloServerPluginDrainHttpServer({ httpServer })], 31}); 32await server.start(); 33 34app.use( 35 cors(), 36 bodyParser.json(), 37 expressMiddleware(server), 38); 39 40await new Promise((resolve) => httpServer.listen({ port: 4000 }, resolve)); 41console.log(`🚀 Server ready at http://localhost:4000`);
Now run your server with:
node server.mjs
Open the URL it prints in a web browser. It will show Apollo Sandbox, a web-based tool for running GraphQL operations. Try running the operation query { hello }
!
No vulnerabilities found.
Reason
30 commit(s) and 9 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 2/21 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
15 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More