This application build according the software constructing course in 2020 autumn. The main goals of making this server to get know how to build REST-ful API and how to use rules of REST for making web applications. I made the server for application called RESTaurant companion, which can be used for administrating the orders in cafes, restaurants or somewhere like that.
- Introduction
- Content
- Building database
- RESTful web-server
- Client web-application
- Developing yourself
I used MySQL 8.0 as my SQL-server
The ER-diagram of database
❕I used INT to represent enum value from user class:
CREATE TABLE IF NOT EXISTS `user`
(
id SERIAL PRIMARY KEY,
`name` CHAR(40),
`login` CHAR(40),
`password` CHAR(255),
`userType` INTEGER DEFAULT 0 NOT NULL
) comment = 'Basic user entity';
❗For running Java code you will need to create user (my database is called restaurant
):
CREATE USER 'rest_comp'@'localhost' IDENTIFIED WITH sha256_password BY 'password';
GRANT ALL ON restaurant.* TO 'rest_comp'@'localhost';
You can find SQL-script used for building the database here.
❕You can use Postman for testing your REST API
Architectural Styles and the Design of Network-based Software Architectures. Roy Thomas Fielding
You can find client web application here
❗ For running RESTful server you need any SQL server running on your machine (or sql-server on a container if you're running Docker)
-
Install MySQL or any other SQL-server. Run the schema.sql and create user
rest_comp
with the passwordpassword
. -
Make sure that you have JRE.
-
Download the latest JAR package from releases and run:
java -jar "RESTaurant companion.jar"
You will need the JDK 14.
-
Clone the repository.
-
Open in IntelliJ IDEA.