summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2021-06-25 12:56:04 +0200
committerMike Vink <mike1994vink@gmail.com>2021-06-25 12:56:04 +0200
commit6bd8d0345e3ac653c3fad4f1c7a6352e8a4a166e (patch)
treef142d3f43add40c2dd56bc496d6b4ab497f31a3e /README.md
parent38d59e2876b9f4d7c589d58295ef8acdf336a45b (diff)
parent102b25f18d9b269c58d15677f10cd71c15003c4b (diff)
Merge branch 'mvcFeature' into mainline
Diffstat (limited to 'README.md')
-rw-r--r--README.md77
1 files changed, 63 insertions, 14 deletions
diff --git a/README.md b/README.md
index ad46ee4..c76d7b7 100644
--- a/README.md
+++ b/README.md
@@ -5,12 +5,64 @@ This repository contains the files for three modules:
- Model view controller: build a website for your own mancala game (or use the sloppy default implementation).
- CI/CD: run your tests automatically when pushing code to Gitlab.
-The skeleton project for the MVC is found on the mvc branch. On that branch, the README is updated with additional information.
## Repository structure
- Main folder (this folder): contains the files relevant for the whole project. For example the Gradle-wrapper files, the .gitignore, and this readme.
+- api/: contains the files for the API or service layer of your application.
+- api/src/main/java/mancala/api: contains the web endpoints.
+- api/src/main/java/mancala/api/models: contains the web endpoints.
- domain/: contains the files that model the business domain (game rules). This is the folder you develop your OO mancala case in.
+- client/: contains the client (front-end)
+
+## Two servers
+
+The project consists of two servers. The front-end uses a Node.js server. It is mainly used to compile your React code into Javascript files during development. This will shorten the feedback loop between changing your code and seeing the results in the browser. The second server is the back-end, which uses a Jetty server. The back-end server allows your Java API to be accessible for other programs, including the front-end server. To prevent [cross-origin request shenanigans (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), all requests from the browser will be sent to the front-end server. That server will then forward to the back-end server if needed.
+
+The front-end assumes that the back-end will run on port 8080. If that is not the case, edit the snowpack.config.js file.
+
+To run the application you need to have both servers running at the same time. This probably means you'll need to open two different terminals/command prompts to do so.
+
+
+## React project structure
+
+A React project is generally structured as follows:
+
+```
+package.json
+public/
+ index.html
+src/
+ Feature1/
+ Feature1.css
+ Feature1.tsx
+ Feature1.tests.tsx
+ Feature2/
+ Feature2.css
+ Feature2.tsx
+ Feature2.tests.tsx
+ Feature2B.tsx
+ Feature2B.tests.tsx
+```
+
+The public directory contains static files, such as the relatively empty index.html file needed to run React. The src file contains the React code. The convention for TypeScript projects is to use the .tsx file extension for files that contain React components. Files are generally grouped together in directories by feature. These directories contain all files related to that feature, such as coponents, stylesheets, images and tests.
+
+## Installing front-end dependencies
+
+To run the React application you'll first need to install the required dependencies. These dependencies are defined in the package.json file. Run the command `npm install` from the `/client` directory.
+
+## Running the front-end
+
+The package.json specifies which commands can be run using npm (e.g. npm run start). In this sample repository, two commands have been defined. You should also run these in the `/client` directory.
+
+```bash
+# Start a development server
+npm run start
+# Check code for common mistakes and style conventions
+npm run lint
+```
+
+
## Java project structure
@@ -46,21 +98,18 @@ You can either install Gradle on your machine and use the installation or use th
./gradlew run
```
-When you run the test, you will see a build failure. In `domain/src/test/java/mancala/domain.FooTest.java`, there is a failing test. If you fix the failing test, the build will succeed.
+If you run the program, you will notice the build "progress" is stuck on 87% or so. That means your application is running and Gradle is waiting for it to succeed. You can ignore the progress bar when running the application; it should print some lines when it's ready.
## Assignment
-For the lectures, see [the drive](https://drive.google.com/drive/u/0/folders/1NK95KK9Ev1yZAz1vLoQSO8rEkZq-A9AC).
-
-Design an object-oriented model for mancala that can handle the following scenarios:
+For the lecture, see [the drive](https://drive.google.com/drive/u/0/folders/1PvC-HS8ty3mdtSaNdR5rt5-GwL-5_LaY).
-- All small bowls start with 4 beads
-- Players take turns making a move
-- A player moves by selecting a small bowl on their own side, take all the beads and distribute them anti-clockwise one at a time
-- When distributing, players include their own kalaha but not the opponent's
-- If a move ends in the own kalaha, the player can make another move.
-- If the last bead ends in an empty bowl on the own side, the player can take that bowl's bead and the direct opposite bowl's bead and put them in their kalaha.
-- The game ends if all bowls of the turn player are empty
-- The winner is the player with the most beads on their territory (all bowls).
+The global goal is to make a web front-end to your mancala back-end. A stub has been made. In api/src/test you can find examples of how you can test the api endpoints.
-Implement the game rules test-driven. Don't be afraid to delete or modify the Foo(Test) files, as they are just an example. \ No newline at end of file
+- Familiarise yourself with the repository. Get the servers running and make sure you can connect to both servers. Enter two names in the boxes. You should see a "TODO" screen.
+- Show the mancala game when it is started.
+- If you want to use your own implementation, reference your implemenation in the `MancalaImpl` class.
+- Build the API endpoint to make a move.
+- Show the winner as soon as the game is over.
+- Optionally, allow for a "revenge" option in which two players can play again.
+- Optionally, allow an ongoing game to continue after a page refresh. \ No newline at end of file