Skip to content

dimmg/SONetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SONetwork

SONetwork is a small RESTful API with the concept of a social network, where users can register and share posts that can be liked / disliked.

Used Technologies:

Prerequisites

  • Python 3.5 or upper

Installation

  • Clone the repository and and cd into it
$ git clone [email protected]/dimmg/SONetwork.git
$ cd sonetwork
  • Create a virtual environment and activate it
$ virtualenv -p python3 env
$ source env/bin/activate
  • Install dependencies
(env) $ pip install -r requirements.txt
  • Generate migrations and apply them
(env) $ python manage.py makemigrations
(env) $ python manage.py migrate
  • Export the environment variables and run the server that will run by default on port :8000
(env) $ HUNTER_API_KEY={{API_KEY}} CLEARBIT_API_KEY={{API_KEY}} python manage.py runserver

Result

The result is a minimalistic RESTful API with the following features:


Authentication 

- User login               POST   /api-token-auth/

Users Management

- User registration        POST   /api/users/
- User retrieval           GET    /api/users/
                           GET    /api/users{id}
- User update              PUT    /api/users/{id}
                           PATCH  /api/users/{id}
                           
Posts Management

- Post creation            POST   /api/posts/
- Post retrieval           GET    /api/posts?author={id}
                           GET    /api/posts/
- Post update              PUT    /api/posts/{id}
                           PATCH  /api/posts/{id}
- Post deletion            DELETE /api/posts/{id}
- Post like                POST   /api/posts/{id}/like
- Post dislike             POST   /api/posts/{id}/dislike

Tests

In order to run tests, execute the following command:

(env) $ python manage.py tests

Bot Runner

To demonstrate that the API is properly working, there is a bot that creates Users, Posts and likes them randomly.

To populate the database entries do:

(env) $ cd /autobot
(env) $ python run.py

About

Minimalistic API using Django Rest Framework

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages