The Monty Hall problem is a brain teaser, in the form of a probability puzzle, loosely based on the American television game show Let's Make a Deal and named after its original host, Monty Hall (learn more).
Clone the repository and run npm install
.
Terminal #1
- run React frontendnpm run start
=>localhost:3000
Terminal #2
- run express backendnpm run server
=>localhost:3100
Run npm run monty-app
builds the React frontend and serves it via express using static middleware at localhost:3100
.
The express backend responds to POST request at localhost:3100/api/monty
.
{
"sampleSize":<Integer>,
"keep":<Boolean>,
"numberOfDoors":<Integer>
}
{
"sampleSize": <Integer>,
"wins": <Integer>,
"keep": <Boolean>,
"numberOfDoors": <Integer>,
"winRate": <Float>
}
While in production the build React app is served from the same port as the backend; in order to cancel this feature it run rm -rf build
in app root folder.