Code Monkey home page Code Monkey logo

social-network-rest-api's Introduction

social-network-rest-api

This is test a task for a job interview.

Task includes creating a sample social network API using Django and DRF. Any batteries are allowed and optional.

Basic part of a project are:

  • User creation with email as a login.

  • JWT token auth.

  • Post that can be created by an authorized user.

  • Post like and dislike.

  • Unittests for created views.

Optional:

  • Email verification with hanter.io on sign up.

  • Additional user data with clearbit.com

To set up and run a project you have to have a docker installed on your OS.

Execute folloving commands inside project directory:

$ docker build .

$ docker-compose run webapp python /src/manage.py migrate

$ docker-compose run webapp python /src/manage.py test

$ docker-compose up --build

To create new user run request like that:

Use your organization domain email since emailhunter will not validate simple mail services like @gmail.com

Or change settings.USE_EMAIL_VERIFIER to False to disable email verification.

$ curl --location --request POST 'http://127.0.0.1:8000/api/users/register/'
--form 'email=[email protected]'
--form 'password=superduper1password'
--form 'password2=superduper1password'

To obtain JWT token run

$ curl --location --request POST 'http://127.0.0.1:8000/api/token/'
--form 'email=[email protected]'
--form 'password=superduper1password'

Use obtained access token as an 'Authorization: Bearer token' header to perform authorized requests.

An authorized user can create or delete Posts and Like/Unlike them.

For API documentation visit:

http://localhost:8000/redoc/

social-network-rest-api's People

Contributors

ymushet avatar dependabot[bot] avatar

Watchers

James Cloos 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.