Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
apollo-server-core
Advanced tools
Package description
The apollo-server-core package is a core library for Apollo Server, which is a community-driven, open-source GraphQL server. It works with various Node.js HTTP server frameworks and provides features necessary to run a GraphQL server, such as schema definition, request processing, and query execution. It's designed to simplify the process of building efficient, scalable GraphQL APIs.
Schema Definition
Allows defining a GraphQL schema using the GraphQL schema language. This is the first step in setting up a GraphQL server.
const { ApolloServer, gql } = require('apollo-server');
const typeDefs = gql`
type Query {
hello: String
}
`;
const server = new ApolloServer({ typeDefs });
Resolvers Implementation
Defines the technique for fetching the types defined in the schema. This code sample shows how to implement a simple resolver.
const resolvers = {
Query: {
hello: () => 'Hello world!',
},
};
const server = new ApolloServer({ typeDefs, resolvers });
Server Setup and Running
Illustrates how to start the Apollo Server and listen on a port. It logs the URL where the server can be accessed.
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
Integrating with Middleware
Shows how to integrate Apollo Server with an Express application using `apollo-server-express`, demonstrating Apollo Server's flexibility with HTTP server frameworks.
const { ApolloServer } = require('apollo-server-express');
const express = require('express');
const app = express();
const server = new ApolloServer({ typeDefs, resolvers });
server.applyMiddleware({ app });
app.listen({ port: 4000 }, () =>
console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`)
);
An Express middleware created by the GraphQL team. It allows the creation of GraphQL servers with Express. Compared to apollo-server-core, it is more tightly coupled with Express and does not offer as extensive a feature set or plugin ecosystem as Apollo Server.
A fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. It is built on top of Apollo Server and other libraries, offering a more opinionated setup with sensible defaults.
A highly flexible and lightweight tool for building GraphQL HTTP servers. Unlike apollo-server-core, GraphQL Helix is not tied to any specific HTTP server framework and focuses on providing a low-level API for handling GraphQL requests.
Readme
This package implements the core logic of Apollo Server. It exports a base version of ApolloServer
. Typically you do not use this class directly but instead use an ApolloServer
imported from the batteries-included apollo-server
package or one of the integration packages like apollo-server-express
.
It also exports a set of plugins such as ApolloServerPluginUsageReporting
which you can provide to the plugins
option to the ApolloServer
constructor.
FAQs
Core engine for Apollo GraphQL server
The npm package apollo-server-core receives a total of 1,022,126 weekly downloads. As such, apollo-server-core popularity was classified as popular.
We found that apollo-server-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.