GithubHelp home page GithubHelp logo

backend-assessment's Introduction

Assignment Scaffolding

Code Navigation

This project consists of a main folder src which contains all the project files. The files outside the source folder consists of docker-compose.yml, Dockerfile and a local.env file which are used for running the docker containers. The src folder contains the entrypoint of the Flask project app.py, settings folder which contains your application settings and an apis folder that stores all your urls and views. The tasks folder contains the tasks.

Installation

Running the scaffolding app is very easy. First install docker for your operating system from the docs provided in the docker website. Also install docker-compose

Then run

sudo docker-compose build

and then

sudo docker-compose up

This will run the server at port http://localhost:8400/

The index view will be displayed in your browser.

Logs

A logs folder is created in the root of the project i.e outside the src folder, which is mounted using the docker-compose volume mount. It will contain a file flask-scaffolding.log and will contain the project logs.

Your Assignment

You have to achieve two major tasks:

Create a Login API (JSON) in flask in this structure.
Setup celery in this project and write a task that stores last login information in another collection of mongo

Go through the structure of the project and figure out how you would proceed.

Make sure that all the api only logic should go in api layer (i.e. views.py) and all the business logic should go in the service layer (i.e. user_service.py). Schema goes in the models/user.py file.

Refer docstrings in the above mentioned files.

Tasks

Celery is used for running the Asynchronous tasks. It is setup to use RabbitMQ as message broker and MongoDB as results backend. Tasks can be found in the tasks i.e inside the src folder.

Testing

Using cURL:

# First create a test user: johndoe
curl -i -X POST -H 'Content-Type: application/json' -d '{"username":"johndoe","password":"iamjohndoe"}' http://localhost:8400/register

# Login with test user:johndoe
curl -i -X POST -H 'Content-Type: application/json' -d '{"username":"johndoe","password":"iamjohndoe"}' http://localhost:8400/login

The Login and register routes accept json data and respond accordingly with respective http status codes.

backend-assessment's People

Contributors

avhvr avatar dependabot[bot] 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.