Coder Social home page Coder Social logo

java-rest-api's Introduction

Java-REST-API

It is a Java API that allows you to manipulate two entities: Project and User.

Here is the structure of the two entities and the relationship between them.

alt text.

Features

  • RESTful routing
  • Models with proper relationships (a user model has one to many projects, a project matches one to one user, one project may have one to many files in it)
  • Controllers/Models etc with proper separation of concerns

Routes List:

projects

Method URI Action
POST projects ekhdemliDrousi\controllers\ProjectController@createProject
GET projects ekhdemliDrousi\controllers\ProjectController@getProjects
GET projects/{id} ekhdemliDrousi\controllers\ProjectController@getProject
DELETE projects/{id} ekhdemliDrousi\controllers\ProjectController@deleteProject
PUT projects/{id} ekhdemliDrousi\controllers\ProjectController@updateProject

Users

Method URI Action
GET users ekhdemliDrousi\controllers\UserController@getUsers
POST users ekhdemliDrousi\controllers\UserController@createUser
PUT users/{id} ekhdemliDrousi\controllers\UserController@updateUser
GET users/{id} ekhdemliDrousi\controllers\UserController@getUser
DELETE users/{id} ekhdemliDrousi\controllers\UserController@deleteUser

user response example

{ "_id": "5bfecf07fa8cd5189412f485", "first_name": "romdhani", "last_name": "kamel", "email": "[email protected]", "password": "admin", "phone": "94428870", "projctsID": [] }

project response example

{ "_id" : ObjectId("5bfc5b5da551e11c8c7cdcad"), "name" : "project3", "description" : "description3", "date_limite" : ISODate("2019-01-09T23:00:00Z"), "post_date" : ISODate("2018-11-24T23:00:00Z"), "etat" : "not solved", "categorie" : "computer science", "files" : [ { "url" : "urlFile3", "name" : "file3" } ], }

project post example

{ "name" : "project3", "description" : "description3", "date_limite" : "2019-01-09", "post_date" : "2018-11-24", "etat" : "not solved", "categorie" : "computer science", "files" : [ { "url" : "urlFile3", "name" : "file3" } ], }

user post example

{ "first_name": "romdhani", "last_name": "kamel", "email": "[email protected]", "password": "admin", "phone": "94428870", }

prerequisites

MongoDB

create a mongodb ekhdemliDrousi : use ekhdemliDrousi .

create collection project : db.createCollection("project").

create collection user : db.createCollection("user").

Maven

How to use :

  • Download or clone the proeject
  • Open eclipse and import it
  • Create the database and both collections "project" and "user"
  • Run the project as spring boot app to consume the API you can use postman, endpoint : http://localhost:8082/

java-rest-api's People

Contributors

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