{"id":15292807,"url":"https://github.com/matthsena/graphql-sailboat","last_synced_at":"2026-01-08T14:07:58.195Z","repository":{"id":39452638,"uuid":"223823959","full_name":"matthsena/graphql-sailboat","owner":"matthsena","description":"Simple \u0026 efficient Node.js GraphQL template :sailboat:","archived":false,"fork":false,"pushed_at":"2023-03-04T05:16:24.000Z","size":726,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T04:47:01.668Z","etag":null,"topics":["graphql","graphql-api","graphql-express","graphql-server","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/matthsena.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":"2019-11-24T23:10:16.000Z","updated_at":"2021-05-09T20:33:19.000Z","dependencies_parsed_at":"2024-10-23T14:00:38.471Z","dependency_job_id":null,"html_url":"https://github.com/matthsena/graphql-sailboat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthsena%2Fgraphql-sailboat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthsena%2Fgraphql-sailboat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthsena%2Fgraphql-sailboat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthsena%2Fgraphql-sailboat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matthsena","download_url":"https://codeload.github.com/matthsena/graphql-sailboat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285816,"owners_count":20752958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["graphql","graphql-api","graphql-express","graphql-server","typescript"],"created_at":"2024-09-30T16:27:19.435Z","updated_at":"2026-01-08T14:07:58.149Z","avatar_url":"https://github.com/matthsena.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL Sailboat :sailboat:\n\nGraphQL Sailboat is a simple and efficient Node.js GraphQL HTTP Server, built with TypeScript and Express. Our goal is to increase productivity in the development of amazing GraphQL APIs. **Just take your sailboat and sail!**\n\n\n## Installation\n```sh\nyarn add graphql-sailboat\n```\n\n## Basic Usage\n```js\nconst { server } = require('graphql-sailboat')\n\nconst schema = `[Your Schema]`\nconst resolvers = { \n    // Your Resolvers\n }\n\n server(schema, resolvers, {\n     path: '/sample', // optional, '/graphql' by default\n     graphiql: false, // optional, true by default\n     port: 8080 // optional, 7000 by default\n })\n\n```\n## Sample with values\n\n```js\nconst { server } = require('graphql-sailboat')\n\nconst data = [{\n  id: 1,\n  tile: \"The Shawshank Redemption\",\n  year: 1994,\n  duration: 142,\n  genre: \"Drama\",\n  imdbRate: 9.3,\n  director: \"Frank Darabont\"\n}, {\n  id: 2,\n  title: \"The Godfather\",\n  year: 1972,\n  duration: 175,\n  genre: \"Drama, Crime\",\n  imdbRate: 9.2,\n  director: \"Francis Ford Coppola\"\n}, {\n  id: 3,\n  title: \"The Dark Knight\",\n  year: 2008,\n  duration: 152,\n  genre: \"Action, Crime, Drama\",\n  imdbRate: 9.0\n}];\n\nconst schema = `\n    type Movie { \n        id: ID!, \n        title: String!, \n        year: Int!, \n        duration: Int!, \n        genre: String!, \n        imdbRate: Float!, \n        director: String \n    } \n\n    type Query { \n        getMovies: [Movie], \n        bestMovie: Movie, \n        searchMovie(_id: ID): Movie \n    }\n`;\n\nconst resolvers = {\n  getMovies: () =\u003e data,\n  bestMovie: () =\u003e {\n    let theBest;\n    let rate;\n    data.map(e =\u003e {\n      if (!rate) {\n        rate = e.imdbRate;\n        theBest = e;\n      } else if (e.imdbRate \u003e rate) {\n        rate = e.imdbRate;\n        theBest = e;\n      }\n    });\n    return theBest;\n  },\n  searchMovie: args =\u003e {\n    const id = args;\n    const movie = data.filter(e =\u003e e.id === id);\n    return movie[0];\n  }\n};\n\nserver(schema, resolvers, {\n  port: 8000\n});\n```\n\n## Express middlewares\n\nYou can acess express object and create custom middlewares importing `app`, like this:\n\n```js\nconst { server, app } = require('graphql-sailboat')\n// example of basic auth middleware\napp.use((req, res, next) =\u003e {\n\n    const auth = { login: 'user', password: 'pass' };\n    const b64auth = (req.headers.authorization || '').split(' ')[1] || '';\n    const [login, password] = Buffer.from(b64auth, 'base64').toString().split(':');\n\n    if (login \u0026\u0026 password \u0026\u0026 login === auth.login \u0026\u0026 password === auth.password) {\n      return next();\n    }\n\n    res.set('WWW-Authenticate', 'Basic realm=\"401\"');\n    return res.status(401).send('Authentication required.');\n})\n// ...\n// ...\n// ...\nserver(schema, resolvers, {\n  port: 8000\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthsena%2Fgraphql-sailboat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthsena%2Fgraphql-sailboat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthsena%2Fgraphql-sailboat/lists"}