Skip to content

manuwebs/ATLBackEnd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ATLBackEnd

Prerequisites

Getting Started

Configure the application

Setting up the database

CREATE DATABASE IF NOT EXISTS ATLBackend;
USE ATLBackend;

CREATE TABLE IF NOT EXISTS Contacts(
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50)
);

CREATE TABLE Contacts_Phones(
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
contactId INT UNSIGNED,
phone VARCHAR(15),
FOREIGN KEY (contactId) REFERENCES Contacts(id)
);

Copy .env.example and rename to .env file and enter your database details.

Development

Install the project dependencies:

composer install

Start the application on the desired port:

php -S localhost:port -t api

Test with API Client

Use an API client to test the app. Ex: Postman.

The available endpoints are:

GET:
localhost:port/contacts - All database contacts
localhost:port/contacts/:id - Single database contact

POST:
localhost:port/contacts - Properties ->
                              firstName (string, required),
                              lastName (string, required),
                              email (string, optional),
                              phones(array, required)

PUT / DELETE:
localhost:port/contacts/:id

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published