Code Monkey home page Code Monkey logo

qlink's Introduction

An application which manages messages and provides details about those messages, specifically whether or not a message is a palindrome. Your application should support the following operations:

  • Create, retrieve, update, and delete a message.
  • List messages. These operations follows proper RESTful design.

YOU CAN EITHER RUN WITH DOCKER OR FOLLOW THE STEP BY STEP PROCESS TO SETUP VIRTUAL ENVRONMENT FOR THE RESTAPI

RUN with Docker

docker build -t newbuild .
docker run newbuild

skip to "MAKE REQUEST" section

STEP BY STEP

Set up a virtual environment using with python3

pip install virtualenv
virtualenv -p python3 qlinkrest
source qlinkrest/bin/activate

Install the following

(qlinkrest) $ pip install flask requests

run the palindrome test

Ensure you are in the code files directory:
(qlinkrest) $ python test.py


Ran 0 tests in 0.000s

OK

run the restApi

(qlinkrest) $ python qlink.py

Make requests

Open another terminal and activate the virtual env

(base) $ source qlinkrest/bin/activate

navigate to the folder containing the code

if you are not in the directory containing the code, navigate there.

open interactive python shell

(qlinkrest) $ python

import request

import requests

List all messages

response = requests.get("http://127.0.0.1:5000")
response.json()

Retrieve a specific message

(EXAMPLE - A message “Ayoola Makinde”)

response = requests.get("http://127.0.0.1:5000/qlink/Ayoola Makinde")
response.json()

Create a new message

(EXAMPLE - Create a message “I live in Guelph”)

response = requests.post("http://127.0.0.1:5000/qlink", json={"I live in Guelph":" "})
response.json()

Update a message

EXAMPLE - Change the message “Cross River State” to "University of Dallas")

response = requests.put("http://127.0.0.1:5000/qlink/Cross River State", json={"University of Dallas":" "})
response.json()

Delete a message

(EXAMPLE - A message “Ayoola Makinde”)

response = requests.delete("http://127.0.0.1:5000/qlink/Ayoola Makinde")
response.json()

qlink's People

Contributors

ayoolamakinde avatar

Watchers

 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.