Skip to content

Benrobo/tymonail-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tymonial Backend API.

The backend api which powers Tymonial.

Setup

  • Clone the repo

    git clone https://github.com/Benrobo/tymonail-api.git
  • Install all dependencies

    // if npm is default package manager
    npm install

    // if yarn is default package manager
    yarn add
  • Create a .env file. Paste and update the created .env file to the variables found in .env.development

    DATABASE_URL="postgresql://postgres:1234@localhost:5432/tymonial?schema=public&connect-timeout=300"

    JWT_SECRET="some-secret-here"

    MAX_API_REQUEST_COUNT = 500

    NODE_ENV="development"

Tymonial kit uses Prisma ORM for managing Postgresql Database. So it compulsory you have postgresql installed, if not follow the link below on setting up postgresql and prisma orm on your pc

    npm run prisma-migrate

This would do two things :

  • It creates a new SQL migration file for this migration

  • It runs the SQL migration file against the database

Congratulation, you can now start exploring and adding other features 🚀.

Start local Server.

    # start api development server
    documents/projects/trakka/api~$ npm run dev

Api EndPoints.

Here are some API endpoint which could be called localy on your computer.

  • Registeration:

    • /api/auth/register.
    • method: POST.
    • Body: username, email, password.
    • Headers:
      • Authorization: NONE
  • Login:

    • /api/auth/login.
    • method: POST.
    • Body: email, password.
    • Headers:
      • Authorization: NONE
  • getUsers:

    • /api/users.
    • method: GET.
    • Body: NONE
    • Headers:
      • Authorization: NONE
  • getUser:

    • /api/user.
    • method: GET.
    • Body: userId
    • Headers:
      • Authorization: AccessToken
  • getTemplates:

    • /api/templates/get.
    • method: POST.
    • Body: userId
    • Headers:
      • Authorization: AccessToken
  • createTemplate:

    • /api/templates/create.
    • method: POST.
    • Body: userId, name
    • Headers:
      • Authorization: AccessToken
  • deleteTemplate:

    • /api/templates/delete.
    • method: DELETE.
    • Body: userId, name
    • Headers:
      • Authorization: AccessToken

NOTE , If any issue were encountered when setting up the backend API, kindly create an ISSUE HERE. your feedback is highly appreciated.

Releases

No releases published

Packages

No packages published