Coder Social home page Coder Social logo

etkirsch / postpyre Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 2.19 MB

A minimalist stack implementing Python 3.7.5, React 16.8+, and PostgreSQL

License: GNU General Public License v3.0

Python 12.03% JavaScript 82.53% Shell 0.49% HTML 2.33% CSS 2.62%

postpyre's People

Contributors

dependabot[bot] avatar etkirsch avatar

postpyre's Issues

Hook up webserver to auth0

This task will add Auth0 domain and audience to the webserver. It will also add route protections against unauthenticated users, shown as a preliminary GET route.

Developer Tasks

  • Implement auth0.py
  • Add a route /about-self to the webserver
    • Route should only accept a GET
    • If un-identified, return 401 using the abort method
    • if identified, return the string success

Requirements

#4 Set up Auth0 site and Audience
#5 Create Heroku Dynos and PostgreSQL Resources

Add basic authenticated API call

If the user is authenticated, show a numeric input field (default 8, valid range is [1, 255]) and a button. When button is pressed, POST a payload (details below) to the server. Then generate a list of N uniformly random integers from 0 to 128 on server, return to React via the format below and display as table.

Route Details for /random:
Payload

{
    length: 5 // valid range is [1, 255]
}

Result

{
    randomized: [1, 29, 13, 245, 100]
}

Note: The /random route returns a 401 if the user did not pass valid jwt

Developer Tasks

  • Implement /random on webserver
    • Accept POST only
    • Require Auth0 credentials, otherwise abort(401)
    • use random.uniform to generate a list of length N, where N is the length value in the payload
    • return the result as JSON using the format above
  • Implement button and API call in UI
    • If the user is authorized, show a numeric input on the landing page that accepts inputs in the range of [1, 255]
    • If the user is authorized, show a button next to the numeric input with the text Generate
    • When the button is clicked, submit a POST call to /random on the webserver using the format of the payload above -- length should be set to the value of the numeric input
    • When the POST call resolves, display the data in an ordered list somewhere on the page -- design not important.
    • If the call fails with a 401, show a div in red text on the landing page that says "Webserver did not recognize credentials for most recent call."
    • If a call fails with a 401 but then a subsequent call resolves correctly, clear the error text from the bullet point above

Create basic Python 3.8 Flask Webserver and Set up Heroku

Erukar 2.0 requires a webserver that is cable of automatic CI-gated deployments. There are a few options which were considered but we will be moving forward with Python 3.8+, Flask, and SQLAlchemy hosted on Heroku dynos.

Developer Tasks

  • Implement a basic webserver using Python 3.8 and Flask
    • Webserver code should be set up under ./webserver/ in this repository.
  • Set up a heroku pipelines to have develop, qa, and prod dyno instances
    • The developer instance should automatically deploy the develop branch (gated by CI)
    • The QA instance should automatically deploy the master branch (gated by CI) and should have the option to promote to prod
    • prod has no automatic deployment and must be promoted from qa
  • Add a PostgreSQL resource to all dynos on heroku
  • Document dynos and pass credentials off to admins (@etkirsch and/or @NullVoxPopuli)
    • These will later be persisted in LastPass for all recognized developers to access

Add Unit and Integration testing to CI

All builds for the Heroku develop and qa dynos must be gated by CI. We need to add a preliminary testing suite to the webserver code covering all functionality aside from direct routes.

Developer Criteria

  • Add preliminary unit and integration testing to webserver
    • Route coverage is not necessary
  • Implement CI gating on Heroku
    • develop dyno points to develop branch
    • qa dyno points to master branch

Prerequisites

#2 Create basic Python 3.8 Flask Webserver and Set up Heroku

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.