Skip to content

OladeleSeyi/chainSpy-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chain Spy BackEnd

This project calculates the current cost of gas and returns the value in your currency. It is the Backend for this project

This is a Python Project built on the Serverless Framework with support for dependencies (using virtualenv & serverless-python-requirements) and tests (using unittest).

How to Use.


A thorough overview of the repo at Notion.

In order to promote a healthy and collaborative repo, please fork the repo and clone your fork to you machine to begin. Follow this guide on collaborating.


Requirements

Installation

Create a new project

$  git clone https://github.com/OladeleSeyi/chainSpy-backend.git

Create a virtual environment for your project for Windows

$ cd chainSpy-backend
$ python -m venv venv

For Intel Macs

$ cd chainSpy-backend
$ virtualenv -p /usr/bin/python3 venv

For M1 Macs using Homebrew installed Python

$ cd chainSpy-backend
$ virtualenv -p /opt/homebrew/bin/python3.9 venv

Activate the virtual environment

MAC

$ source venv/bin/activate

Windows

$  source myenv/Scripts/activate

Install Serverless plugin: serverless-python-requirements

$ npm install

Usage

Install a Python dependency (for example, Requests)

$ pip install requests

Run on your Machine

sls offline start

While this may be buggy on M1 macs, I hope it works for you.

Store a reference to your dependencies

$ pip freeze > requirements.txt

Re-install your dependencies from your requirements

$ pip install -r requirements.txt

Invoke a function locally

$ serverless invoke local -f hello

Run your tests

$ python -m unittest discover -s tests

Deactivate your virtual environment

$ deactivate

Deploying

Deploy your project

$ serverless deploy

Deploy a single function

$ serverless deploy function --function hello

To compile non-pure Python modules, install Docker and the Lambda Docker Image. Enable dockerizePip in serverless.yml and serverless deploy again.

# enable dockerize Pip
custom:
  pythonRequirements:
    dockerizePip: true

Note, if you are deploying using SEED, you don't need to enable dockerizePip or install Docker. SEED does it automatically.

About

Get Gas Prices in your local currency

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages