This project is aiming to pratice the MERN Stack skills. When finished, it can replace my current personal website from WordPress to React.
- WORDPRESS VERSION: https://lukegong.com (hosted on CPANEL)
- MERN VERSION: http://ec2-3-25-135-244.ap-southeast-2.compute.amazonaws.com/ (hosted on AWS EC2 instance)
Host the frontend files using create-react-app
Docker added: if you want to run on localhost, you have to do the following things:
- change the
"proxy": "http://backend:8000/"
to"proxy": "http://localhost:8000/"
Host the backend files using express
and node.js
Docker added: if you want to run on localhost, you have to do the following things:
- In
server.js
, change themongodb://mongo:27017
tomongodb://localhost:27017
Combined the build
frontend files into backend, no docker setup, so you have to have your own mongo client installed and import the initial files under mongo-seed
directory.
for docker container: add the default data into mongo docker client.
- React.js
- Node.js
- Express
- mongo
- View page
- Three.js
- login
- Connect to mongoose
- check Role table, if table is empty, create three roles.
- /api/auth/signup
- Middleware 1:verifySignUp.checkDuplicateUsernameOrEmail
- Middleware 2: verifySignUp.checkRolesExisted
- controller.signup => save to mongodb, object is User and Role
- /api/auth/signin
- controller.signin => finduser by username in mongodb
- use bcrypt.compareSync to check password
- get token by jwt.sign
- res to send roles and token
- /api/test/(user or mod or admin)
- middleware: authJwt to verify token
- Admin page
- Edit Form
- Form Syle (dropdown, rich text)
- New Form
- Delete
- Contact Form send email
- Docker
- Deploy using git
- Deploy using Travis
- Use Jest
- create dockerfile for each app
- create docker-compose yml file to combine multiple services
- run
docker-compose up -d mongo
first to initial mongodb - run
docker-compose up -d mongo-seed
to add initial data into mongodb - run
docker exec -it mongo bash
to check if the initial data is been pushed - run
docker-compose up -d backend
to run the web app - run
docker-compose up -d frontend
to run the web app