Giter Site home page Giter Site logo

odera-dickens / pesakit Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 643 KB

A simple API that enables users to register/login and view profile details with Passport authentication.

Shell 0.55% PHP 68.41% Blade 30.66% Vue 0.38%
api laravel-ui tdd passport laravel laravel8x phpunit php

pesakit's Introduction

About

This is a simple api that enables users to register, login and view their profile details. An admin is also able to login into their dashboard and view the list of registered users and their particular details

Prerequisites

  • Download and install Composer
  • Download and install Postman for API Testing

Installation

Follow through the following steps setting up the application on your local development environment

git clone https://github.com/odera-dickens/pesakit.git <your_preffered_app_name>
cd <your_preffered_app_name>
composer install

Database Setup

cp .env.example .env
Create a database at your local db server then at the created .env file, add the following 
DB_DATABASE=<your_new_db>

Database Configurations

php artisan:key generate
php artisan migrate
php artisan db:seed (to create an admin user)

npm Set Up

npm install
npm run dev

API Authentication Support

This project uses Laravel Passport for the API Authentication

Passport Accest Tokens

To create client access tokens for accessing the api endpoints when testing, run the following command

php artisan passport:install

API Endpoints

User Registration

METHOD: POST
Endpoint: /api/v1/user/register
Params: 
1. name (required)
2. email (required)
3. phone (required)
4. password (required)
5. password_confirmation (required)

User Login

METHOD : POST
Endpoint: /api/v1/user/login
Params:  
1. email (required)
2. password (required)

User Logout

METHOD : POST
Endpoint: /api/v1/user/logout
Params:  
1. Bearer-Token

User Profile Details

METHOD : GET
Endpoint: /api/v1/user/profile
Params:  
1. Bearer-Token

Web Endpoints

Admin

Sample Admin Account : { email: [email protected], password: password }
/login
/admin/dashboard
/admin/users
/admin/users/{user}/profile

User

/login
/user/dashboard

Testing The API

In order to effectively test the api, ensure you have Postman installed on your machine

php artisan test (to run all the tests)
php artisan test --filter=<test_name> (check tests/Feature/Api/UserAuthenticationTest)

pesakit's People

Contributors

odera-dickens avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.