Giter Site home page Giter Site logo

python-junior-backend's Introduction

python-junior-backend

Set up

  1. cd app/
  2. mv .env_example .env
  3. Confirm the port 5001 and port 32000 are not used in your device.
  4. docker-compose up -d

* Your device needs to install docker, docker-compose first.

Test the API (/signIn, /signuUp, /userInfo)

*Method 1: Swagger API

http://<your_server>:5001/apidocs/

Method 2: curl

/signUp

curl --location --request POST 'http://<your_server>:5001/signUp' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "[email protected]",
    "name": "abc",
    "username": "abc",
    "password": "12345678"
}'

/signIn

curl --location --request POST 'http://<your_server>:5001/signIn' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "[email protected]",
    "password": "12345678"
}'

/userInfo

curl --location --request GET 'http://<your_server>/userInfo' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTY3MDg3MjkwMSwianRpIjoiNzkzNTUwNWYtODlmZC00ZDBlLWFhYTEtYzAxNTMwMDRmMjM1IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6eyJ1aWQiOjEsImVtYWlsIjoiMUBnbWFpbC5jb20iLCJ1c2VybmFtZSI6ImFiYyIsIm5hbWUiOiJhYmMifSwibmJmIjoxNjcwODcyOTAxLCJleHAiOjE2NzA4NzM4MDF9.fKBYUcc66wOHVci3XqmRZvTB6i6qT3YzKb3jVvwJMVg'

*Note: Change <your_server> to your server domain name or IP & --data-raw's json data.


Method 3: postman

/signUp

Method: POST
URL: "http://<your_server>:5001/signUp"
requestBody:
{
    "email": "[email protected]",
    "name": "abc",
    "username": "abc",
    "password": "12345678"
}

/signIn

Method: POST
URL: "http://<your_server>:5001/signIn"
requestBody:
{
    "email": "[email protected]",
    "password": "12345678"
}

/userInfo

Method: GET
URL: "http://<your_server>:5001/userInfo"
Authorization:
    Type: Bearer Token
    Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTY3MDg3MjkwMSwianRpIjoiNzkzNTUwNWYtODlmZC00ZDBlLWFhYTEtYzAxNTMwMDRmMjM1IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6eyJ1aWQiOjEsImVtYWlsIjoiMUBnbWFpbC5jb20iLCJ1c2VybmFtZSI6ImFiYyIsIm5hbWUiOiJhYmMifSwibmJmIjoxNjcwODcyOTAxLCJleHAiOjE2NzA4NzM4MDF9.fKBYUcc66wOHVci3XqmRZvTB6i6qT3YzKb3jVvwJMVg

*Note: Change to your server domain name or IP & --data-raw's json data.

Requirement checklist

  • 1. Implement a membership website
    • Flask framework
    • POST /signUp
    • POST /signIn
    • GET /userInfo (Authentication by Bearer Token)
    • Database Table field contains (username, password ,name, email)
    • ORM SQLAlchemy
    • Input data validation
    • OpenAPI spec: swagger
  • 2. Implement the decorator in /signIn API
    • First login print "Welcome back {name}".
  • Deploy by docker

python-junior-backend's People

Contributors

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