Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
adonis-apollo
Advanced tools
Apollo GraphQL server for AdonisJS 5.
Maintained by Zakodium
:warning: This module is unstable and in active development. Use at your own risk. |
---|
This provider requires Adonis v5 and won't work with AdonisJS v4.
npm i adonis-apollo
node ace configure adonis-apollo
Then add the following to the "metaFiles"
array in .adonisrc.json
:
{
"pattern": "app/Schemas/*",
"reloadServer": true
}
Bind the apollo server to your AdonisJs application.
In start/routes.ts
:
import ApolloServer from '@ioc:Zakodium/Apollo/Server';
ApolloServer.applyMiddleware();
// You can also call `applyMiddleware` inside a route group:
Route.group(() => {
ApolloServer.applyMiddleware();
}).middleware('someMiddleware');
Apollo requires a query root type to be defined in your schema.
To fix this error, create a file app/Schemas/SomeSchema.graphql
with at least
a Query
type.
For example:
type Query {
hello: String!
}
This error may happen if you try to access the GraphQL endpoint from a browser.
Make sure forceContentNegotiationTo
is not unconditionally set to 'application/json'
in config/app.ts
.
You can either disable this option or set it to a function that ignores the GraphQL route.
TODO
To configure the default landing page, you can pass apolloProductionLandingPageOptions
or apolloLocalLandingPageOptions
to the config. Another possibility is to
override the plugins
config in config/apollo.ts
.
The default configuration is:
import {
ApolloServerPluginLandingPageLocalDefault,
ApolloServerPluginLandingPageProductionDefault,
} from '@apollo/server/plugin/landingPage/default';
const plugins = [
Env.get('NODE_ENV') === 'production'
? ApolloServerPluginLandingPageProductionDefault({
footer: false,
apolloProductionLandingPageOptions,
})
: ApolloServerPluginLandingPageLocalDefault({
footer: false,
apolloLocalLandingPageOptions,
}),
];
See the Apollo Graphql documentation to learn how to customize or disable the landing page.
All the resolvers from graphql-scalars
are installed automatically.
To enable any of the scalar types documented in graphql-scalars
,
for example DateTime
, just add a scalar line to your schema:
scalar DateTime
To enable support for GraphQL uploads:
config/bodyparser.ts
by adding your GraphQL route (by default: /graphql
) to the multipart.processManually
array.scalar Upload
.FAQs
Apollo GraphQL server for AdonisJs
The npm package adonis-apollo receives a total of 14 weekly downloads. As such, adonis-apollo popularity was classified as not popular.
We found that adonis-apollo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.