Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
/ snakebite Public archive

backend API server running on Falcon framework and alcohol. Ciders & Lagers not included.

Notifications You must be signed in to change notification settings

biteupco/snakebite

Repository files navigation

Snakebite

Build Status

Snakebite is built with Python, and more specifically with Falcon framework and MongoEngine (python client for MongoDB).

To get started, please follow instructions below on how to setup your environment to run Snakebite

Instructions

Prerequisites for Local Environment

Snakebite assumes a MongoDB data store for persistence. Make sure you have MongoDB installed and a running instance for Snakebite to connect to.

You may change the settings in the dev.ini file in config directory.

First, clone this repository onto your local machine

$ git clone https://github.com/gobbl/snakebite.git
$ cd snakebite

We first need to install all the dependencies or packages needed (a virtualenv is recommended).

$ python setup.py develop

Up and Running

Before running the application, we need to have our database up. Do $sudo mongod. Assuming you are already in the project directory, simply run the following command:

$ gunicorn manage:snakebite.app

Point your browser to localhost:8000/restaurants (thereby making a GET request). Try adding params in your URL, for instance, http://localhost:8000/restaurants?location=Roppongi&tags=casual

To try a POST request, you can do the following via the Terminal:

$ curl -X  POST -H "Content-Type:application/json" -d '[PAYLOAD HERE]' http://localhost:8000/restaurants

If you wish to see the response in prettyprint, you can pipe the response with Python's json module: | python -m json.tool

Of course, you may prefer to use POSTMAN.io (easy GUI) to make these POST request. That is fine too. Do note that Snakebite only accepts json content-type for POST requests.

To see the current implemented endpoints, hop over to the wiki page

Testing & Contributing

Before pushing codes, please ensure that the code is checked against flake8 firstly

$ python setup.py flake8

Next, to check tests and coverage reports:

  1. Ensure MongoDB is running on your local machine. To start MongoDB: $ sudo mongod

  2. Run the tests by doing: $ coverage run setup.py nosetests

Let's try to keep the code clean with Flake8, and less bug-free with testing! Target coverage: 80% (current: 100%)

Deploying

When deploying to environments other than your local environment ('dev'), please ensure that you set the 'BENRI_ENV' environment variable in the OS before running the server. This is so that the right config file can be loaded for initializing the application.

API methods

A list of API methods can be found here

About

backend API server running on Falcon framework and alcohol. Ciders & Lagers not included.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages