LogoLogo
DL Docs
DL Docs
  • Getting Started
    • Welcome to Dev Launchers
      • Onboarding Checklist
      • Roles & Responsibilities
        • Development
        • Research
        • Design
        • Technical Lead
        • Product Owner
        • Product Manager
        • Quality Assurance
      • The Definitive Guide for Team Members
  • Design
    • Design at Dev Launchers
  • Research
    • Research at Dev Launchers
      • Introduction to Our Research Culture
        • Learning Opportunities
      • Meet the Team (org Chart)
      • First Week Checklist - Welcome to Dev Launchers!
      • Research Process & Practices
        • Planning & Strategy
        • Research Methods (Qualitative & Quantitative)
          • Usability Testing on Mobile Devices Remotely
        • Data Collection & Analysis
        • Reporting & Presenting Findings
      • Our Projects
      • FAQ
  • Development
    • Development at Dev Launchers
      • Infrastructure and CI/CD Overview
      • Backend Documentation
    • Frontend Documentation
      • Organization of Applications & Projects within Monorepo
      • Requesting the Backend
      • Authentication
      • Yarn package management
      • Page
  • Product Management
    • Product Management at Dev Launchers
  • Learning (WIP)
    • Previous Learning Opportunities
    • Smart Goals Template
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Development
  2. Frontend Documentation

Requesting the Backend

All requests to the backend should utilize the `agent` in the frontend.

PreviousOrganization of Applications & Projects within MonorepoNextAuthentication

Last updated 6 months ago

Was this helpful?

  • The agent is located at /packages/utility/agent.ts

  • To include other objects when requesting data, for example, to get the likes associated with a given comment, we can specify the fields to populate in the URL request parameters

    • If at all possible, we should avoid use populate=deep, because it is very resource intensive

  • The agent uses a cookie for handling authentication to the backend.

    • No credentials need to be passed in to the agent by developers, as it will use the existing cookie automatically.

  • Each model in our database should have a corresponding object in the agent.

    • For example, likes has an object in the agent which allows us to get, put, post, or delete likes

    • Developers need to add new objects to the agent whenever new models are added to the database.

  • Because agent is written in TypeScript, we also need to make sure the database models, located in /packages/models/ are in sync with the current database models in the backend (Strapi)

  • Because the data returned by Strapi contains some extra fields and nested objects, it is suggested to "clean" the response data so it is formatted in the same way as our TypeScript models

    • To do this, we can use a helper method, such as the one located at /apps/ideaspace/src/utils/StrapiHelper.js