Setting up TypeORM and MySQL
In this section, we'll install and configure TypeORM in our server project.
TypeORM is a Node.js and TypeScript Object Relational Mapper (ORM). It lets you build and query database tables with TypeScript and high-level programming structures such as classes, decorators, and functions, rather than SQL commands.
Return to your Terminal. To start the server, make sure you're within the server's project and then perform the following commands:
cd ngsocial/packages/server/ npm start
Ascertain that you are inside the server's project. After that, execute the following commands in another Terminal:
cd ngsocial/packages/server/ npm install typeorm reflect-metadata mysql
The reflect-metadata
library is essential in providing support for the TypeScript decorators required by TypeORM.
Next, open the tsconfig.json
file and make the following changes:
{ "compilerOptions": { "...