git clone https://github.com/ueewbdy93/wedding-screen.git && cd wedding-screen && git submodule update --init- Build backend:
cp src/config.sample.ts src/config.ts && npm install && npm run build - Build frontend:
npm install --prefix frontend/ && npm run build --prefix frontend/ - Start server:
npm run start - Now you can browse the service with your favorite browser at http://localhost:5566 as user and, http://localhost:5566/admin-index.html (password: happy) as admin.
- User: https://wedding-screen.herokuapp.com/
- Admin (password: happy): https://wedding-screen.herokuapp.com/admin-index.html
A wedding activity web app implemented by a happy programmer couple dy93 and ueewbd ❤️.
There are two modes and a admin page
-
slideshow mode:
Users can see wedding pictures and leave bullet comments.
-
game mode:
This mode was inspired by Kahoot!. Since Kahoot does not show full description of options on users' phone and it's a requirement for us. We decided to implement this game service by ourselves.
-
admin page:
Admin can switch between modes and control the game state.
The whole web app consists of two projects: wedding-screen and wedding-screen-frontend. The former is responsible for back-end and the other is for front-end. We manage wedding-screen-frontend as a git submodule of wedding-screen.
- Nodejs 10
-
Clone the project from github.
git clone https://github.com/ueewbdy93/wedding-screen.git -
cd into project folder.
cd wedding-screen -
Install dependency.
npm install -
Set up configurations.
cp src/config.sample.ts src/config.ts -
Compile typescript into javascript.
npm run build
Now, the back-end work is done. Follow the steps below to prepare front-end.
-
Check out
wedding-screen-frontend.git submodule update --init -
cd into frontend folder.
cd frontend -
Install dependency of wedding-screen-frontend.
npm install -
Build code.
npm run build -
Start server.
cd ../ npm run start
OK! Now you can visit http://localhost:5566 to watch slideshow or play game.
Visit http://localhost:5566/admin-index.html and login(default password:happy) to control the state.
Edit wedding-screen/src/config.ts (If not exists, copy from wedding-screen/src/config.sample.ts), see config.sample.ts for more detail.
| property | description |
|---|---|
| admin.password | Admin login password. |
| slide.intervalMs | Slideshow interval. |
| slide.urls | Paths of slideshow pictures, auto generate by scanning wedding-screen/public/images/*.jpg |
| game.intervalMs | Answer time |
| game.questions | Array of questions. The format of question: { text: <string>, options: [<string>], answer: <string>} |
- Compile typescript in watch mode:
npm run build -- --watch - Modify the code under src
- Whenever you modify the code, restart the server
wedding-screen-frontend is a submodule of wedding-screen and link to frontend/ folder.
The project is initiated by create-react-app (CRA). Base on CRA, we integrated it with redux, redux-thunk, websocket, css-module and storybook(for test).
We ejected CRA configurations and made some changes:
- Allow multiple entry points. One for user page the other for admin page.
- Enable css module.
Followings are the steps to develop.
-
Run the back-end server
cd wedding-screen npm run startAlthough CRA will run webpack-dev-server to host static files in development mode. However, we need to connect to back-end server to deal with actions (ex: add comment). We proxy some uris (/socket, /images/ and /resources/) to the back-end server. See Proxy API Requests in Development.
-
cd into frontend/
-
Modify code under frontend/src/ to meet your need.
-
Runs the app in development mode.
npm run startThis command will open
http://localhost:3000in browser. And page will automatically reload if you make changes to the code.
dy93: You barely have errors when you are writing typescript.
To be fix.
We use storybook to have a quick demo of react components.
Just run npm run storybook and visit http://localhost:9009.
[x] slideshow
[x] game/score
[ ] game/final
[ ] game/joinList
[ ] game/qa
[ ] game/nameInput
[ ] adm
