Skip to content

pandeatul27/EZDues_Backend

Repository files navigation

EzDues Backend

Prerequisites

  • Install node_modules, by running the following command (Note: package manager used for this project is npm)

    $ npm i
  • Create a .env file, with the following contents:

    PORT=5000
    NODE_ENV='development' # would be subject to change.
  • Create auth.env with following content

    EMAIL= <systemEmail> /* the email from which you want to send email */
    PASSWORD = <systemEmailPassword> /* password of above email */
  • Install MySQL server and MySQL Workbench.

  • Create Database as per the URI set in the env

  • Apply migrations to database by running the following command:

    $ npx prisma migrate dev

How to run?

  • For development (You are most likely concerned with this command)

    $ npm run dev
  • For non-daemon process

    $ npm run start

Database (MySQL with Prisma)

  1. Make sure that you have populated the DATABASE_URL environment variable in your .env file with a valid URL.
  2. Populate the file prisma/schema.prisma with appropriate models.
  3. Run the following command:
    $ npx prisma migrate dev --name <NAME>
    Here NAME is the name of the migration you wish to give.
  4. The above command takes care of 2 things:
    • Makes appropriate changes to the database.
    • generates @prisma/client which has typing and functions for each model as ORM.
  5. The prisma/seed.js file creates a Super Admin whenever we migrate prisma or we can do it manually by command:
    $ npx prisma db seed

Conventions you might wanna abide by.

  • Use kebab-case for URL paths.

    • Undesirable Examples:
      • /user/forgotPassword
      • /User/Forgot-Password
      • /get_User_Details
    • Acceptable Examples:
      • /user/forgot-password
      • /get-user-details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published