Now its time to do the most exciting parts,connect our nodejs app to our database.
First, i set up a basic node js + express app then added typescript.
1.Make a project directory
2.Move into that directory
3.Create package.json file
npm init --yes
4.Use an express generator for the general app structure
npm install -g express-generator-typescript
5.Next we need to get our connection credentials and connect to the database and make a query.
Here we have our config object which we shall use in our route file.
Here,i placed my credentials within an env file for security purposes.All needed credentials are
- server name
- database name
- a port number
Next, i am thinking of deploying this as an app service.