Elentra API
  • Introduction
  • Developers
    • Getting Started
    • Quickstart Guide
      • Set up Repositories
      • Validate the setup
      • Exploring the API
      • Creating a new Module
      • Setup Routing
      • Introduction to Postman
      • Create a Controller
      • Using Eloquent Models
      • Input Validation
      • API Resource Authorization
  • Elentra API Standards
    • HTTP Methods & Status Codes
    • Routing & Parameters
      • Example Routing Patterns with HTTP Method
        • /courses/{course}/contacts
        • /courses/{course}/contacts?type={contact_type}
        • /courses/{course}/contacts/{contact}
        • /courses/{course}/syllabus
      • Common Mistakes
        • [GET] /admissions/file-review/file/rubric-score/{cycle_id}/{pool_id}/{subpool_id}
        • [DELETE] /notices/1,2,3
        • [GET] /cbe/curriculum/framework/{framework_id}/hierarchy-by-depth
        • [GET] /admissions/file-review/file/rubric-score/delete/{id}
        • [GET] /portfolio/entries/{entry_id}/get-file
        • [POST] /cbe/curriculum/updateframework
  • Automated Testing
    • Getting Started
      • Setting up a testing environment
      • Running Automated Tests
    • Seed Data
      • Folder Structure
      • Creating Seed Data
    • Functional Tests
      • Creating a Functional Test File
      • Testing HTTP Verbs
        • Creating an HTTP Test
        • GET Requests
        • POST / PUT / DELETE Requests
        • GraphQL Requests
      • Asserting API Response
      • Annotations
    • Code Style Linting
Powered by GitBook
On this page
  1. Developers
  2. Quickstart Guide

Exploring the API

A quick guide to the parts of the API folder heirarchy

PreviousValidate the setupNextCreating a new Module

Last updated 2 years ago

Exploring the directory structure of the Elentra API, you will see a number of directories and files:

The top level directories are

  • app - this is where the Laravel Application lives. Most of the Elentra API endpoints are in the Modules directory, which is where the Caffeinated Modules are stored.

  • bootstrap - the bootstrap directory contains helpers to initialize the API, linking to the app directory and also enabling the API to see the Elentra ME (CPD, Admissions) constants and models

  • config - laravel configuration files

  • database - database initialization code

  • resources - contain some default language files for validation messages

  • routes - contains the top level routes of the API, specifically the default '/' route used for testing and the authentication routes for login and logout. All other routes are specific to Modules and located in the app/Modules directories.

  • tests - currently not used

Note also that there is a composer.json at the top level of the Laravel API. This would include any dependencies needed by all of Laravel. Inside each Caffeinated Module, there can be an additional composer.json that lists the dependencies of that Module.

Inside the app folder are all the directories of the Laravel application.

  • Auth - this directory contains all the supported authentication methods for the API. Individual schools may need to modify some of these methods to match the specific school requirements.

  • Console - any custom artisan commands can be added here

  • Events - for Laravel Event system. Currently Elentra API has no top level implementation for Events

  • Exceptions - top level Exception definitions for token handling and validation errors

  • Http - this contains controllers, middleware and parsers related to the authentication endpoints

  • Jobs - for Laravel Job system. Currently not used

  • Libraries - currently contains helpers for Authentication methods

  • Listeners - for Laravel listeners. Currently not used

  • Models - contains Eloquent model definitions for the Authentication related tables. Some other generic models are located here which can be extended inside Modules, although the recommended architecture for common models is still a WIP

  • Modules - this contains all the currently implemented Caffeinated Modules, which implement the supported API endpoints. This directory will continue to grow as functionality is migrated from Elentra (ME, CPD, Admissions) to Elentra API

  • Policies - used for Authorization policies. There is a top level ACLPolicy class here which should be inherited in the Caffeinated Modules to implement the authorization for every API endpoint.

  • Providers - contains all the currently supported Laravel Service Providers for the Elentra API.

The Modules folder is where much of the API development work will be done. This Quick Start will go through the process to create a new Caffeinated Module and set it up to represent a set of new API Endpoints.

The contents of each Module folder looks just like the content of the app folder - in a way each Caffeinated Module is just like a small Laravel application on its own. Each of the directories contain the specific implementation of routes, controllers, models, etc unique to that specific module.