Coder Social home page Coder Social logo

hngx-task2's Introduction

HNGx CRUD API Documentation

Welcome to the CRUD API documentation Laravel application. This API allows you to Create, Read, Update, and Delete user records.

Table of Contents

Getting Started

Prerequisites

Before you start, make sure you have the following prerequisites installed on your system:

  • PHP (>= 7.4)
  • Composer
  • Laravel (>= 8.x)
  • Database (e.g., MySQL, PostgreSQL)

Installation

  1. Clone this repository:

    git clone https://github.com/GoodnewsPerfect/HNGx-task2
    cd HNGx-task2 
  2. Install PHP dependencies using Composer:

    composer install
  3. Create a .env file by copying the .env.example file and configure your database settings:

    cp .env.example .env

    Configure the database config variables as follows:

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=laravel
    DB_USERNAME=root
    DB_PASSWORD=
    
  4. Run the migrations:

    php artisan migrate
  5. Start the development server:

    php artisan serve
    

    Laravel API is now up and running on {127.0.0.1:8000} which is the base url!

API Endpoints

Request and Response Formats

The API uses JSON for both requests and responses. The following table describes the JSON format for the requests and responses:

Requests Response
POST /api 201 Created with the newly created user in the response body
GET /api 200 OK with an array of users in the response body.
GET /api/{id} 200 OK with the user with the specified id in the response body.
PUT /api/{id} 200 OK with the updated user in the response body.
DELETE /api/{id} 204 No Content

Sample Usage

Adding a new user (201 Created)

Create new user

Fetch a user detail (200 OK)

fetch a user

Modify the details of an existing user (200 OK)

modify the details of an existing user

Remove a user (204 No Content)

remove a user

Fetch users (200 OK)

fetch all users

hngx-task2's People

Contributors

goodnewsperfect avatar

Watchers

Dawud Ahmad 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.