[DEPRECATED] CSR & frameworkless based web application
 
 
 
 
Go to file
Raphael Cerveaux 16af6f5c6c
Merge pull request #20 from Sundowndev/client
[Fix #19] CSR client
2018-09-08 19:56:51 +02:00
client [Fix #19] CSR client 2018-09-08 19:18:26 +02:00
docker Initial commit 2018-07-08 20:17:19 +02:00
server Disable Allow Origin 2018-09-08 19:16:17 +02:00
.dockerignore [Fix #11] [Fix #10] Client docker image 2018-08-05 01:35:17 +02:00
.gitignore Initial commit 2018-07-08 20:17:19 +02:00
.travis.yml Fix typo in scripts 2018-07-10 10:59:04 +02:00
Dockerfile [Fix:bug] composer install not working 2018-07-12 18:04:11 +02:00
Dockerfile.client [Fix #11] [Fix #10] Client docker image 2018-08-05 01:35:17 +02:00
Dockerfile.h2-proxy Initial commit 2018-07-08 20:17:19 +02:00
Dockerfile.nginx Initial commit 2018-07-08 20:17:19 +02:00
LICENSE WTFPL license 2018-07-10 11:12:44 +02:00
README.md [Translation] Description 2018-07-26 12:42:35 +02:00
docker-compose.yaml [Fix #19] CSR client 2018-09-08 19:18:26 +02:00

README.md

interview-v1

Build status :

Description

1/ Develop a mini PHP REST API with json output

This api must manage 2 objects :

  • User (id, name, email)
  • Task (id, user_id, title, description, creation_date, status)

Create API endpoints to recover a user or task data. (e.g /user/{id})

The API must be able to manage users tasks and create the endpoints to:

  • Fetch the latest tasks
  • Create a task
  • Delete a task

While developing this API, you must keep in mind it can evolve at any moment (new resources, new properties in objects ...).

2/ Create a frontend client to call the API

  • The client must call the api using ajax
  • We must be able to create/delete an user
  • Manage user's tasks (read / add / delete)

(no framework)

Installation and usage

$ git clone git@github.com:Sundowndev/interview-v1.git
$ cd interview-v1/
$ docker-compose up -d

You can now browse the front app at localhost:3000 and the API at localhost:8000.

Architecture

The architecture is made of a simple client -> server communication using Docker containers.

Database

Security

To handle authentication feature, we use JWT authentication.

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA. Source

As soon as the user provide valid credentials, we return a JWT token that will be needed for each request the client will send to the API.

For each request, the user send the JWT token as parameter.

JWT explained

API endpoints

Method / Route Resource Description
POST /auth Authentication Connect and get an api key
GET /tasks Task Get latest taks
GET /tasks/{id} Task Get a task by given id
POST /tasks Task Create a task
PUT /tasks/{id} Task Update a task by given id
DELETE /tasks/{id} Task Delete a task by given id
GET /me Users Get your own account data
GET /users/{id}/tasks Users,Tasks Get tasks from a given user id