Package Exports
- apollo-server-native
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (apollo-server-native) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Apollo Server integration for HTTP, HTTPS and HTTP2
This integration of Apollo Server works with native HTTP, HTTPS and HTTP2.
Example with HTTP
Install apollo-server-native
package with npm or yarn
const http = require('http')
const { ApolloServer, gql } = require('apollo-server-native')
const typeDefs = gql`
type Query {
"A simple type for getting started!"
hello: String
}
`
const resolvers = {
Query: {
hello: () => 'world'
}
}
const server = new ApolloServer({ typeDefs, resolvers })
const serverHandler = server.createHandler()
const httpServer = http.createServer()
httpServer.on('request', serverHandler)
httpServer.listen(3000, () => console.log(`🚀 Server ready at http://localhost:3000`))