resolvers = resolvers Ī close examination will notice that the SELECT in each statement renames the elements - so the column FirstName in chinook.db is renamed firstName. InitialisationĪt the terminal create a directory, and install the relevant packages:Ĭonst db = require ( 'better-sqlite3' )( 'chinook.db', exports. It probably isn’t a great place to start though if you don’t understand the GraphQL fundamentals, in that case you might try Oh-so minimal GraphQL API example with Apollo Server first.Īll code can be found at the repo PreciousChicken/sqlite-graphql-apollo-server. This worked example is designed to mimic the tutorial as closely as possible - the queries and responses are almost exactly the same. As per the site I’m using the sample database chinook.db. The differences being I’m using the better-sqlite3 rather than the sqlite3 npm package 1 and I’m using a GraphQL API (powered by Apollo Server) to present the data (as opposed to console.log). This worked example builds on their Querying Data in SQLite Database from Node.js Applications tutorial. The website has some good pointers on using the SQLite database.
0 Comments
Leave a Reply. |