GithubHelp home page GithubHelp logo

project-front's Introduction

Front-project

Project to practice HTML/CSS/JavaScript skills

Goals

  • HTML - create an html page to display a table with a list of accounts.
  • CSS - visualize page.
  • Javascript - generate basic CRUD (create, read, update, delete) operations based on provided api. Validate input data.

To run project

  1. Download Tomcat(version 9 - Important) : https://tomcat.apache.org/download-90.cgi.
  2. Set up the launch of the application through the Idea: Alt + Shift + F9 -> Edit Configurations… -> Alt + insert -> tom (in the search bar) -> Local.
  • After that, you need to click CONFIGURE and indicate where the archive with Tomcat was downloaded and unpacked.

  • In the Deployment tab: Alt + insert -> Artifact… -> rpg:war exploded -> OK.

  • Leave only / (forward slash) in the Application context: field.

  • Click APPLY.

  • Close the settings window.

  1. Launch the application. To do this: Alt + Shift + F9 -> (config name, I named it 'App') -> Run.
  2. After deploying the application, a new tab will open in the browser selected during configuration.

Api

Get players list

URL -	/rest/players
Method -	Optional: Integer pageNumber, Integer pageSize
Data Params -	None
Success Response - Code: 200 OK
Content: [
 {
  “id”:[Long],
  “name”:[String],
  “title”:[String],
  “race”:[Race],
  “profession”:[Profession],
  “birthday”:[Long],
  “banned”:[Boolean],
  “level”:[Integer]
 },
 …
]

Notes

- pageNumber – a parameter that is responsible for the number of the displayed page when using paging.
The numbering starts from zero.

- pageSize – parameter that is responsible for the number of results on one page when paging.

public enum Race {
    HUMAN,
    DWARF,
    ELF,
    GIANT,
    ORC,
    TROLL,
    HOBBIT
}

public enum Profession {
    WARRIOR,
    ROGUE,
    SORCERER,
    CLERIC,
    PALADIN,
    NAZGUL,
    WARLOCK,
    DRUID
}

Get players count

URL	- /rest/players/count
Method -	GET
URL Params -	None
Data Params -	None
Success Response	- Code: 200 OK
Content: Integer

Delete player

URL - /rest/players/{id}
Method - DELETE
URL Params -	id
Data Params - None
Success Response -	Code: 200 OK

Notes	

- If the player is not found - response with an error code 404.

- If the id value is not valid, the response will be an error with a 400 code.

Update player

URL	- /rest/players/{id}
Method -	POST
URL Params -	id
Data Params:	
{
  “name”:[String],       --optional
  “title”:[String],     --optional
  “race”:[Race], --optional
  “profession”:[Profession], --optional
  “banned”:[Boolean]    --optional
}

Success Response - Code: 200 OK
Content: {
  “id”:[Long],
  “name”:[String],
  “title”:[String],
  “race”:[Race],
  “profession”:[Profession],
  “birthday”:[Long],
  “banned”:[Boolean],
  “level”:[Integer]
 }
 
Notes	
- Only fields that are not null are updated.

- If the player is not found in the database, the response is an error with the 404 code.

- If the id value is not valid, the response is an error with a 400 code.

Create player

URL -	/rest/players
Method -	POST
URL Params -	None
Data Params:	
{
  “name”:[String],
  “title”:[String],
  “race”:[Race],
  “profession”:[Profession],
  “birthday”:[Long],
  “banned”:[Boolean], --optional, default=false
  “level”:[Integer]
}
Success Response - Code: 200 OK
Content: {
  “id”:[Long],
  “name”:[String],
  “title”:[String],
  “race”:[Race],
  “profession”:[Profession],
  “birthday”:[Long],
  “banned”:[Boolean],
  “level”:[Integer]
 },
 
Notes	

We cannot create a player if:

- not all parameters from Data Params are specified (except for banned);
- the length of the “name” or “title” parameter value exceeds the size of the corresponding field (12 and 30 characters);
- the value of the “name” parameter is an empty string;
- the level is outside the specified limits (from 0 to 100);
- birthday:[Long] < 0;
- date of registration are outside the specified limits.
- In the case of all of the above, the response is an error with a 400 code.

project-front's People

Contributors

nikolaevdo avatar vasylmalik 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.