GithubHelp home page GithubHelp logo

caycomtech-task's Introduction

CaycomTech Application Task

Running directions:
  • Open root folder
  • Run "python3 -m venv venv"
  • Run "source venv/bin/activate"
  • Run "pip install -r requirements.txt"
  • Run "flask run"

If you facing anyproblem while running app you can contact me : [email protected]

Web App

caycomtech-task Web App sends request to caycomtech-task API and renders responses.

Routes:

Index (/) :

redirects /login if no jwt. redirects /customer if jwt exists.

Logout (/logout) :

kills session and jwt. redirects /login.

Register (/register) :

registration page.

Login (/login) :

login page. starts jwt session with successful login.

Customers (/customers) :

show all customers in a table. ** jwt required route **

Customers (/customers/< string:id >) :

show a customer on a table row by id. ** jwt required route **

Update (/update/< string:id >) :

update a customer by id. ** jwt required route **

Other errors (dynamic route):

returns error with message.

Delete (/delete/< string:id >) :

delete a customer by id. ** jwt required route **

404 (/404) :

returns 404 with message.

API

All API points except register/login needs Bearer token.

Sample user information for testing

{
   "name":"caycom",
   "surname":"caycom",
   "email":"caycom",
   "password":"caycom",
   "phone_number":"caycom",
   "identification_number": "caycom"
}

API Points

All api points are listed:

GET
  • /customers : JWT Authorization needed route. List Customers.
  • /customers/int:customer_id : JWT Authorization needed route. Show customer by given id in route parameter.
POST
  • /register : Register user.
  • /login : Login user. Returns a token.

Sample request body for this route

{
   "email":"caycom",
   "password":"caycom",
}
PATCH
  • /customers/int:customer_id : JWT Authorization needed route. Patch user by given parameters.
DELETE
  • /customers/int:customer_id : JWT Authorization needed route. Deletes user by id.

End of routes.

  • INCLUDES UNIT TESTS: /app/tests/test
    • SqlAlchemy Test Cases
    • Unauthorized Access Test Cases
    • Register Test Cases
    • Login Test Cases
    • Authorized Access Test Cases

From root base terminal run nose2 command to run tests.

  • INCLUDES LOGGING: /demo.log

Sample Token

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDM1NDk3NTcsIm5iZiI6MTYwMzU0OTc1NywianRpIjoiZGQ3OTA3ZmUtOTcyZi00MDI0LWE2M2MtMGQwZDVmMjllYzhlIiwiZXhwIjoxNjA0MTU0NTU3LCJpZGVudGl0eSI6IjEiLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MifQ.0tdDXse9cj7dAcS_L2OGdC3gMyNZ_Z6TaRixCKDTm5E

caycomtech-task's People

Contributors

nadas00 avatar

Watchers

 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.