Skip to content

rqkohistani/Nodejs-REST-APIs-part-three-USING-PRISMA

Repository files navigation

A SECURE NODEJS REST API IS BUILT USING PRISMA AND AZURE DATA STUDIO IN PART THREE

This Nodejs REST API part three is intended to be secure and user-friendly, and it makes use of best API practices


The APIs could be improve over time to be more secure.


Steps to run Node JS REST API part three


Confingure Azure Data Studio and Prepare the database

  1. Configure Azure Data Studio download link

    1. Platform: Windows Use installer (recommended)

    2. Install Azure Data Studio

    3. Open Azure Data Studio

    4. From Welcome tab, Click on Deploy a server

    5. Select Sql server on Windows

    6. version: SQL Server 2019

    7. Insall SQL Server 2019

      1. Select instlation type: Basic
      2. Open SQL Server Config. Manager
      3. Navigate to “Protocols for MSSQLSERVER”
      4. Enable TCP/IP
      5. Agree to the license terms Default
      6. SQL Server Configuration
      7. Navigate to SQL Server Services
      8. Right click on the SQL Server (MSS…). Click Restart
      9. SQL server service
  2. Create a connection

    1. server: localhost

    2. connect

    3. ServerLocalHost

    4. SuccessConnection

    5. Create a new database nodejsPart3Prisma

    6.  USE master
       GO
       IF NOT EXISTS (SELECT name
       FROM sys.databases
       WHERE name = N'nodejsPart3Prisma')
       CREATE DATABASE [nodejsPart3Prisma];
       GO
       USE nodejsPart3Prisma;
       GO
      

Clone the repo

  1.  npm install
  2. .env file should filled with the correct values. Check the .env.example.md file for more info.

  3.  npx prisma migrate dev --name init
  4. Seed the database once or comment out seed(); function in the seeding file

    npx prisma db seed
  5. Check database to see if the data is seeded

    1. Refresh the database
    2. In dbo.user table, there should be 2 users seeded
      1. admin and user
  6. npm start

  7. Use postman to test the APIs

Export the APIs collection to the Postman

  1. Download the Nodejs Rest API P3_Prisma.postman_collection.json file on the current repo

  2. Launch Postman

  3. Select the import icon.

  4. Upload the Nodejs Rest API P3_Prisma.postman_collection file

  5. Go to auth/login and enter the username and password

  6.  {
     "email": "admin@gmail.com",
     "password":"password"
     }

  1. Here you can check out how part two apis was used

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published