{"id":40090374,"url":"https://github.com/lukinco/adonis-apollo-server","last_synced_at":"2026-01-19T10:03:04.599Z","repository":{"id":143774387,"uuid":"268884612","full_name":"lukinco/adonis-apollo-server","owner":"lukinco","description":"GraphQL implementation using Apollo Server for Adonis","archived":false,"fork":false,"pushed_at":"2025-01-24T12:31:20.000Z","size":107,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-18T17:38:19.929Z","etag":null,"topics":["adonis","apollo-server","graphql","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukinco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-02T18:59:21.000Z","updated_at":"2025-01-24T12:31:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"8dd0eb88-5c0c-42ff-8350-92177b889010","html_url":"https://github.com/lukinco/adonis-apollo-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lukinco/adonis-apollo-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukinco%2Fadonis-apollo-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukinco%2Fadonis-apollo-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukinco%2Fadonis-apollo-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukinco%2Fadonis-apollo-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukinco","download_url":"https://codeload.github.com/lukinco/adonis-apollo-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukinco%2Fadonis-apollo-server/sbom","scorecard":{"id":604950,"data":{"date":"2025-08-11","repo":{"name":"github.com/lukinco/adonis-apollo-server","commit":"1aceb8358aa336a42c1a8eef7636ec9c8e658130"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 2/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T01:21:46.357Z","repository_id":143774387,"created_at":"2025-08-21T01:21:46.357Z","updated_at":"2025-08-21T01:21:46.357Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adonis","apollo-server","graphql","hacktoberfest"],"created_at":"2026-01-19T10:03:03.823Z","updated_at":"2026-01-19T10:03:04.588Z","avatar_url":"https://github.com/lukinco.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# adonis-apollo-server\n\n\u003cp align=\"center\"\u003e\n  :us: \u003ca href=\"/README.md\"\u003eEnglish\u003c/a\u003e\u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp; :brazil: \u003ca href=\"/docs/pt-br.md\"\u003ePortuguês do Brasil\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"/design/logo-primary.png\" /\u003e\u003c/p\u003e\n\n\u003e GraphQL implementation using Apollo Server for Adonis\n\nThis package integrates Apollo GraphQL Server with the AdonisJS framework. It allows you to use Apollo server in your AdonisJS app.\n\n\u003e **NOTE:** This package requires [@adonisjs/bodyparser](https://github.com/adonisjs/adonis-bodyparser) and [graphql](https://github.com/graphql/graphql-js)\n\n## Installation\n\n```bash\nyarn add --exact @lukinco/adonis-apollo-server\n```\n\n### Registering provider\n\nMake sure to register the provider inside `start/app.js` file.\n\n```js\nconst providers = [\n  '@lukinco/adonis-apollo-server/providers/ApolloServerProvider'\n]\n```\n\nThat's all!\n\n## Usage\n\nNow you can use the provider by pulling it from IoC container\n\n```js\n// start/routes.js\n\n'use strict'\n\nconst Route = use('Route')\nconst ApolloServer = use('ApolloServer')\n\nconst typeDefs = `\n  type Query {\n    testString: String\n  }\n`\n\nconst resolvers = {\n  Query: {\n    testString () {\n      return 'Seems to be working!'\n    }\n  }\n}\n\nconst schema = { typeDefs, resolvers }\n\nRoute.post('/graphql', ({ auth, request, response }) =\u003e {\n  return ApolloServer.graphql({ \n    options: {\n      schema,\n      context: { auth }\n    },\n    request,\n    response,\n    onError: (errors) =\u003e {\n      // this function is optional. \"errors\" is an array of all errors. \n      // You may show the errors the way you want to.\n      // If this function is defined, you must return an array of errors.\n    }\n  })\n})\n\nRoute.get('/graphiql', ({ request, response }) =\u003e {\n  return ApolloServer.graphiql({\n    options: { endpointURL: '/graphql' }, \n    request, \n    response\n  })\n})\n```\n\n## Uploads\n\nTo make uploads, you must set `autoProcess: false` on `config/bodyParser.js`.\n\nYou must define the field that will receive the uploaded file with scalar type `Upload`:\n\n```gql\ntype Mutation {\n  upload (file: Upload!): String\n}\n```\n\n#### Usage\n\nYou may create a helper file in `app/Helpers/upload.js`:\n\n```js\n'use strict'\n\nconst fs = require('fs')\nconst { join } = require('path')\nconst slugify = require('slugify')\nconst { v4: uuidv4 } = require('uuid')\nconst Env = use('Env')\n\nconst UPLOAD_DIRNAME = 'uploads'\nconst FULL_UPLOAD_PATH = join(process.cwd(), 'public', UPLOAD_DIRNAME)\n\nfs.mkdir(FULL_UPLOAD_PATH, { recursive: true }, () =\u003e {})\n\nmodule.exports = async (file) =\u003e {\n  const { createReadStream, filename } = await file\n  const fileStream = createReadStream()\n  const newFilename = `${uuidv4()}-${slugify(filename, { lower: true })}`\n\n  const pathToUploadFile = join(FULL_UPLOAD_PATH, newFilename)\n  const uploadDistStream = fs.createWriteStream(pathToUploadFile)\n\n  await new Promise((resolve, reject) =\u003e {\n    uploadDistStream.on('finish', resolve)\n\n    uploadDistStream.on('error', (error) =\u003e {\n      console.log('error', error)\n      fs.unlink(pathToUploadFile, () =\u003e reject(error))\n    })\n\n    fileStream.on('error', (error) =\u003e uploadDistStream.destroy(error))\n\n    fileStream.pipe(uploadDistStream)\n  })\n\n  return `${Env.get('UPLOAD_HOST')}/${UPLOAD_DIRNAME}/${newFilename}`\n}\n```\n\nLibs `slugify` and `uuid` are optional, but they will help you to create unique filenames.\n\nYou can use an env var `UPLOAD_HOST`, like my example, if you want to upload files in different places by environment.\n\nThen, when you want to make an upload, you just have to use that function, passing the file received as argument, and the function will return a Promise, that resolves to a full path of the file uploaded.\n\nTo send a file, look the next examples.\n\n#### How to test using Insomnia\n\nOn Insomnia, you must use Multipart requests, and send 3 fields:\n\n- `operations`: a JSON with `query` and `variables` keys:\n\n```json\n{\n  \"query\": \"mutation ($file: Upload!) {\\n  upload (file: $file) \\n}\",\n  \"variables\": {\n    \"file\": null\n  }\n}\n```\n\n- `map`: a JSON mapping the file that will be upload with your variables set in `operations`:\n\n```json\n{\n  \"0\": [\"variables.file\"]\n}\n```\n\n- `0`: the file itself. `0` is used here because we set in `map` above that `0` will point to our `variables.file` entry.\n\nThat's it :)\n\n#### How to write tests\n\nIn Adonis v4, you have to install `axios` and `form-data` libraries to make the upload work on server side.\n\nThen, you can use a helper to upload file like this:\n\n```js\nconst fs = require('fs')\nconst gql = require('graphql-tag')\nconst { print } = require('graphql/language/printer')\nconst axios = require('axios')\nconst FormData = require('form-data')\nconst Env = use('Env')\n\nasync function requestQuery ({ client, token, query, variables, file }) {\n  if (token) {\n    response = response.header('Authorization', `Bearer ${token}`)\n  }\n\n  const operations = {\n    query: print(query),\n    variables,\n  }\n\n  file = typeof file === 'string'\n    ? { field: 'file', attach: file }\n    : file\n\n  const variableInput = Object.keys(variables)[0] === file.field\n    ? `${file.field}`\n    : `${Object.keys(variables)[0]}.${file.field}`\n\n  const map = {\n    0: [`variables.${variableInput}`],\n  }\n\n  const form = new FormData()\n  form.append('operations', JSON.stringify(operations))\n  form.append('map', JSON.stringify(map))\n  form.append('0', fs.createReadStream(file.attach))\n\n  return axios\n    .post(`${Env.get('APP_URL')}/graphql`, form, {\n      headers: {\n        authorization: `Bearer ${token}`,\n        ...form.getHeaders(),\n      },\n    })\n}\n```\n\nThen, just write your test:\n\n```js\nconst fs = require('fs')\nconst { test, trait } = use('Test/Suite')('Upload')\nconst Helpers = use('Helpers')\nconst gql = require('graphql-tag')\nconst { expect } = require('chai')\n\ntrait('Test/ApiClient')\ntrait('Auth/Client')\n\nconst UPLOAD = gql`\n  mutation ($file: Upload!) {\n    upload (file: $file) {\n      location\n    }\n  }\n`\n\ntest('Should upload an image with mimetype PNG', async ({ client }) =\u003e {\n  const file = Helpers.tmpPath('file.png')\n  fs.writeFile(file, 'TEST', () =\u003e {})\n\n  const response = await requestQuery({\n    client,\n    token, // use a token if you only want allow uploads for logged in users\n    query: UPLOAD,\n    variables: { file: null },\n    file,\n  })\n\n  const result = response.data\n\n  expect(response.status).to.be.equal(200)\n  expect(result).to.have.keys('data')\n  expect(result.data).to.have.keys(['upload'])\n  expect(result.data.upload).to.be.a('string')\n})\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukinco%2Fadonis-apollo-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukinco%2Fadonis-apollo-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukinco%2Fadonis-apollo-server/lists"}