Code Monkey home page Code Monkey logo

back-end-workshop's Introduction

Backend Workshop

In this workshop we go over AWS, Flask, and Back-end development as whole! The slides can be found here

Installation

First clone the repository and open it in the terminal.

Assuming you already have Python 3 installed. The first thing you need to do is download Flask, Flask SQLAlchemy, dotenv and psycopg2-binary for making this application run as follows:

pip3 install Flask Flask-SQLAlchemy psycopg2-binary python-dotenv 

You will have to set up a PostgreSQL database by yourself (you can set it up on AWS like we did in the workshop or run it locally using a tool like this . Once that is done follow the next steps.

We need to set up the .env file which will be used to connect the database to flask.

  1. Create a .env file in the main directory
touch .env
  1. Edit .env file and put in the variable you need to setup the database such as username, password, etc.

For example:

HOST=124.256.289.10
USERNAME=google
PASSWORD=alexa

Why we use .env?

Since we do not want to put our credentials online for anyone to see. We create a .env file which containes these information for us. This .env file is added to .gitignore file so that any changes to this file is not registered by git.

Running the application

To run the API we need to run the API file with python3 as shown:

python3 ./src/api.py

Example usage (We recommend using a tool like Postman to send these requests)

GET /api/article
GET /api/article/:id
POST /api/article

Expected Type: raw JSON

Expected Data: {
    'title': 'Welcome to GDSC',
    'author': 'gdscutm',
    'body': 'Lists of workshop'
}
PUT /api/article/:id

Expected Type: raw JSON

Expected Data: {
    'title': 'Welcome to UTMGDSC'
}

back-end-workshop's People

Contributors

milindvishnoi avatar daniel-laufer avatar

Stargazers

Wentao Zhou avatar  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.