Code Monkey home page Code Monkey logo

broadcast's Introduction

broadcast

An application for broadcasting data in rooms for your contacts.

Installation

After downloading repository you need to do some configurations to start the project.

Creating user and database in MYSQL

For this run the following SQL:

create database rooms_broadcast;
create user 'username'@'%' identified by 'password';
use rooms_broadcast;
grant all on rooms_broadcast.* to 'username'@'%';

If you change 'username' and 'password' in the above code, make sure to update src/main/resources/application.properties with the same data

Run the application

Run the following lines in commmand prompt with directory set to this project.

mvnw clean package
java -jar target/broadcast-0.0.1-SNAPSHOT.jar

Usage

Register user

Request example

POST http://localhost:8080/register
Content-type: application/json
RequestBody
{
    "username": "user1",
    "password": "user1"
}

Response example

{
    "id": 1,
    "username": "user1"
}

Authenticating user

Request example

POST http://localhost:8080/authenticate
Content-type: application/json
RequestBody
{
    "username": "user1",
    "password": "user1",
    "platform": "ios",
    "uuid": "asdjflqkwer"
}

Response example

{
    "jwtToken": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ1c2VyMSIsInVzZXJfaWQiOjEsImV4cCI6MTU5Mjg0Mjg1NSwidXVpZCI6ImFzZGpmbHFrd2VyIiwiaWF0IjoxNTkyODI0ODU1LCJwbGF0Zm9ybSI6ImlvcyJ9.tnuQzNbpNJc_cQ97aEN9pKFPWfdMb9MD1rt_jIfV381F3rF27QVAcq-ptrbWqWaf3CXm65JT_6Dpn0lkOT-l8g"
}

Adding contacts

Request example

POST http://localhost:8080/users/1/contacts
Content-type: application/json
RequestBody
{
    "contactId":2
}

Response example

{
    "id": 2,
    "username": "user2"
}

Adding private rooms

Request example

POST http://localhost:8080/users/1/rooms
Content-type: application/json

Response example

{
    "id": "FVb1bfz",
    "ownerId": 1
}

Getting user

Request example

GET http://localhost:8080/users/1
Content-type: application/json

Response example

{
    "id": 1,
    "username": "user1"
}

Getting rooms of User

Request example

GET http://localhost:8080/users/1/rooms
Content-type: application/json

Response example

[
    {
        "id": "FVb1bfz",
        "ownerId": 1
    }
]

Getting contacts of User

Request example

GET http://localhost:8080/users/1/contacts
Content-type: application/json

Response example

[
    {
        "id": 2,
        "username": "user2"
    },
    {
        "id": 3,
        "username": "user3"
    }
]

For testing broadcast in public room

Go to localhost:8080/rooms/public/{roomId}

For testing broadcast in private room

Go to localhost:8080/rooms/private/{roomId}

broadcast's People

Contributors

huseynovramilx avatar

Watchers

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