Build a Health Tracking App with React, GraphQL, and User Authentication

Build a Health Tracking App with React, GraphQL, and User Authentication

This article shows you how to build a health tracking app with React, GraphQL, TypeORM, and User Authentication.

Anthony Benkhebbab

That’s so neat, thanks you!

Chris Metzger

Hello, After setting up the project, connecting to mysql, and then updating the index.ts file I run “npm start” and it begins running and then crashes with an error message of:

QueryFailedError: ER_CANNOT_ADD_FOREIGN: Cannot add foreign key constraint
at new QueryFailedError (D:\health-tracker\graphql-api\src\error\QueryFailedError.ts:7:9)

I’ve done a bunch of searching and I can not figure out at all why this is occuring. My database schema type is InnoDB and I can’t find anything that indicates why this is occuring. Can you offer any advice at all? Thanks.

Matt Raible

Hello Chris,

Can you please provide the commands you used to create your database? I can try to reproduce and fix.

Thanks,

Matt