Git Product home page Git Product logo

c4c_api's Introduction

c4c_api

C4C API's

Features

c4c_api has the following modules:

  1. Registration: for registration of HCW (self-registration or register for someone else)
  2. Report exposure: individual and for someone else.
  3. FAQ section: Contains all frequently asked questions and their responses.
  4. Learning module: Contains facility based and general learning materials for HCWs.
  5. Broadcasting of messages
  6. Immunization profile: allows updating/viewing of immunization details for the HCW
  7. Checkin module: allows certain user types to checkin to a facility during their working hours
  8. Annual immunization & checkup calendar- allows viewing immunization history andsetting of annual checkup date.
  9. Report COVID-19 exposure: allows reporting of a COVID-19 exposure that the HCW may encounter

Installation

Please check the official laravel installation guide for server requirements before you start. Official Documentation

Alternative installation is possible without local dependencies relying on Docker.

Clone the repository

git clone https://github.com/mHealthKenya/c4c_api.git

Switch to the repo folder

cd c4c_api

Install all the dependencies using composer

composer install

Copy the example env file and make the required configuration changes in the .env file

cp .env.example .env

Generate a new application key

php artisan key:generate

Generate a new JWT authentication secret key

php artisan jwt:generate

Run the database migrations (Set the database connection in .env before migrating)

php artisan migrate

Create a public and private key in the storage folder oauth-private.key oauth-public.key

Start the local development server

php artisan serve

You can now access the server at http://localhost:8000

TL;DR command list

git clone https://github.com/mHealthKenya/c4c_api.git
cd c4c_api
composer install
cp .env.example .env
php artisan key:generate
php artisan jwt:generate 

Make sure you set the correct database connection information before running the migrations Environment variables

php artisan migrate
php artisan serve

Dependencies

Folders

  • app - Contains all the Eloquent models
  • app/Http/Controllers - Contains all the api controllers
  • app/Http/Middleware - Contains the JWT auth middleware
  • app/Http/Helpers - Contains the helper functions
  • app/Http/Jobs - Contains the functions for creating queued jobs
  • app/Http/Controllers/Api - Contains all the api controllers
  • app/Http/Controllers/Api/UserController.php - Contains the functions implementing the user module
  • app/Http/Controllers/Api/ResourcesController.php - Contains the functions implementing the resource center module
  • app/Http/Controllers/Api/ImmunizationController.php - Contains the functions implementing the immunization module
  • app/Http/Controllers/Api/ImmunizationController.php - Contains the functions implementing the immunization module
  • app/Http/Controllers/BroadcastsController.php - Contains the functions implementing the broadcasts module
  • app/Http/Controllers/DataController.php - Contains the functions and queries for the highcharts
  • config - Contains all the application configuration files
  • database/factories - Contains the model factory for all the models
  • database/migrations - Contains all the database migrations
  • routes/api - Contains all the api routes
  • tests - Contains all the application tests

Environment variables

  • .env - Environment variables can be set in this file

Note : You can quickly set the database information and other variables in this file and have the application fully working.


Testing API

Run the laravel development server

php artisan serve

The api can now be accessed at

http://localhost:8000/api

Request headers

Required Key Value
Yes Content-Type application/json
Yes X-Requested-With XMLHttpRequest
Optional Authorization Token {JWT}

Refer the api specification for more info.


Authentication

This applications uses JSON Web Token (JWT) to handle authentication. The token is passed with each request using the Authorization header with Token scheme. The JWT authentication middleware handles the validation and authentication of the token. Please check the following sources to learn more about JWT.


Cross-Origin Resource Sharing (CORS)

This applications has CORS enabled by default on all API endpoints. The default configuration allows requests from http://localhost:3000 and http://localhost:4200 to help speed up your frontend testing. The CORS allowed origins can be changed by setting them in the config file. Please check the following sources to learn more about CORS.

Dependencies

  • laravel-cors - For handling Cross-Origin Resource Sharing (CORS)

License

license

Open Source Love

c4c_api's People

Contributors

muokid3 avatar cynthiakamau avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.