GithubHelp home page GithubHelp logo

simplechat's Introduction

SimpleChat

This is a simple chat application that allows user to:

- [x] register
- [X] login implements JWT
- [x] view profile
- [x] edit profile 
- [x] create a chat
- [x] edit a chat
- [x] edit profile/chat implements security(Only owner can edit)
- [x] list all chats
- [x] view all messages in a chat
- [x] create a message in a chat
- [x] logout

Technologies

- Java
- Spring Boot, Spring: Data JPA, Rest, Validator, MVC, ...
- JUnit, Mockito
- Maven
- MySQL
- Log4j2
- JSON Web Token
- Redis

Requirements

What you will need: - JDK 1.8 or later version installed - Maven 3.5+ - MySQL 5.7+ - Redis

Database configuration

  • You can change the database's connection and name in application.properties, you can find it inside resources directory
  • Here I'm using root as my username and password, you can change according to your current configuration

Build

From the root of project directory (you will find pom.xml file there) run the following command

	mvn clean install

	java -jar target/simplechat-0.0.1.jar

You also use the following command

	mvn spring-boot:run

Test

The application will initialize some data from sample data set in import.sql in resource directory.

  • Note: register and login request won't be filter with jwt. Other request required a valid token from successful login

Using POSTMAN

Register

Login

  • url: http://localhost:8080/login (POST) sample data

      {		
      "username": "reg",
      "password": "1234"
      }
    
  • Upon successful login it will return jwt token

Logout

User list

Note: (username is unique)

create user

url: http://localhost:8080/api/users (POST), sample data (id is not required, see register )

	 {
	"id":"7",
	"username": "uzer7",
	"password": "1234",
	"firstName": "Python",
	"lastName": "Piper",
	"email": "[email protected]"
	}		 

view user

url: http://localhost:8080/api/users/1 (GET), 1 is user id

update user

url: http://localhost:8080/api/users (PATCH), sample data

	 {
	"id":"7",
	"username": "uzer7",
	"password": "1234",
	"firstName": "Python Update",
	"lastName": "Piper",
	"email": "[email protected]"
	}

Chat list

create chat

url: http://localhost:8080/api/chats (POST) , sample data

	 {
	"id":"5",
	"owner": "1",
	"message": "Chat message number 5 by user 1",
	"postedDate": "2017-10-04T22:44:30.652"
	}

view chat

url: http://localhost:8080/api/chats/5 (GET), 5 is chat id

update chat

url: http://localhost:8080/api/chats (PATCH), Sample data

	{
	"id":"1",
	"owner": "1",
	"message": "Update chat id 1 chat date",
	"postedDate": "2016-10-04T22:44:30.652"
	}

Message list

create message

url: http://localhost:8080/api/messages (POST) , sample data

	 {
	"id":"5",
	"user": "1",
	"chat": "1",
	"message": "message reply to chat id 1",
	"postedDate": "2014-05-04T22:44:30.652"
	}

view message

url: http://localhost:8080/api/messages/1 (GET), 1 is chat message id

update message

url: http://localhost:8080/api/messages (PATCH), Sample data

	{
	"id":"1",
	"owner": "1",
	"chat": "1",
	"message": "Update message id 1 chat date",
	"postedDate": "2016-11-04T22:44:30.652"
	}

Versioning

The api path '/api/' can be change in application.properties file. You can find the file under resources directory

	api.path: api

Contributor

simplechat's People

Contributors

roat167 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.