Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

kazimierczak-robert/ErlangExercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ErlangExercises

Erlang applications for academic purposes

math_server

Server evaluates arithmetic expressions: addition, subtraction, multiplication, division. Input data sent as parameters in the URL query. The first parameter specifies the arithmetic operation, the next - the next action arguments. The input language of HTTP requests in EBNF notation:


URL                   = IP addr. & port No ,  request ;
IP addr. & port No    = “127.0.0.1:8080?” ;
request               = calculation , “&” , integer , { “&” , integer } ;
calculation           = “plus” , “minus”, “mult”, “div” ;
integer               = “0” | [ "-" ] , digit ;
digit                 = “0” | digit without 0 ;
digit without 0       = “1” |  “2” |  “3” |  “4” |  “5” |  “6” |  “7” |  “8” |  “9” ;

dict_rest

REST application for creating and managing a Polish-English dictionary. The available API includes methods (word ": word" is a variable meaning a word in Polish language which is the password in the dictionary):

Request Request Method Additional argument Meaning
/list GET NO Display with meanings saved words
/get/:word GET NO Display word: word with meaning
/create/:word POST YES
  • header: Content-Type - application/x-www-form-urlencoded
  • body: content - word_meaning_:word
Add word:word
/update/:word POST YES
  • header: Content-Type - application/x-www-form-urlencoded
  • body: content - word_meaning_:word
Update the meaning of the word: word
/delete/:word DELETE NO Delete the word: word
/help GET NO Display help (all available API commands)
/

Server methods:

Method Meaning
allowed_methods/2 Listing of supported HTTP requests
content_types_provided/2 Redirecting GET requests to the appropriate methods due to the format of the returned response
content_types_accepted/2 Redirecting POST requests to the appropriate methods due to the format of the query received
db_to_json/2 Redirecting GET queries with returned JSON response to the appropriate methods due to the type of API query
db_to_text/2 Redirecting GET queries with the returned response in text format to the appropriate methods due to the type of API query
text_to_db/2 Redirecting POST requests to the appropriate methods due to the type of API query
delete_resource/2 The method called when using the / delete method
resource_exists/2 A method that verifies word existing in the dictionary
get_record_list/2 A method that returns all saved words with meanings in JSON format
get_record_list_text/2 A method that returns all saved words with the meanings in a text format
get_one_record/2 The method returns a single word with the meaning in JSON format
get_one_record_text/2 The method that returns the word with the meaning in text format
create_record_to_json/2 The method that saves the new word with the meaning to the dictionary
update_record_to_json/2 The method updating the dictionary by updating existing word meaning
get_help/2 A method that returns all available API commands in JSON format
get_help_text/2 A method that returns all available API commands in text format

Adding the word "mirror" with the meaning to the dictionary:

ws_calc

Client-server appliacation using WebSocket protocol that reconstructs th operation of a simple calculator operating on a set of real numbers. The server provides mathematical operations:

  • binary operations:
    • adding,
    • subtraction,
    • multiplication,
    • division,
  • unary operations:
    • square root,
    • reverse.

An equality operator completes calculations and displays the final result or reset calculations (AC). The client is an HTTP site with JavaScript scripts used to communicate with the server.

Attributions

Credits

  • Monika Grądzka
  • Robert Kazimierczak