I’d like to share how to add new resolvers to already implemented graphql server HackaTalk
Here, I’d like to add Gallery
model which is a table that has columns photoURL
and anid
which is a primary key.
When you are just adding a new table to an existing database without changing any other table’s association, you don’t need to generate any migration script from sequelize. Let’s create Gallery
model.
- Add
sequelize
model.
2. Import Gallery
model so it will export root models to index.ts
.
3. Create gallery.graphql
in src/schemas
.
4. Import grallery.graphql
in schema.graphql
which is a root of schemas.
5. Let’s add a few resolvers for this model.
6. Run graphql-codegen
.
7. Create gallery.ts
in resolver
dir.
8. Implement resolvers.
It is done for adding new resolvers to the running HackaTalk
server. You can check out the pull request to find out more about it 💃.
P.S. We will work on the test code in the future post!