This repo provides a simple MERN stack application to be used in containerization demos. It is intended to NOT be a containerized application, but will be converted as part of demos.
This particular application is composed of an Express backend with a React frontend. Data is persisted in a Mongo database. Hence the MERN stack name.
The Express backend is configured to serve static content, allowing the React application to be bundled and deployed with the backend. But, they remain in separate codebases because development for each uses different tooling.
This application requires Mongo. If you haven't yet, install it and then start a database.
mongod
To start the backend, run the following in the backend
directory:
yarn install
yarn dev
The backend runs on localhost:4000
To start the frontend, run the following in the client
directory:
yarn install
yarn start
The react app will start on localhost:3000.
To deploy the application, you will need to do the following:
-
Build the frontend.
cd frontend yarn build
-
Copy the artifacts from the newly created/populated
frontend/build
directory intobackend/src/static
directory. -
Deploy the
backend
directory and start it usingnode src/index.js
. The frontend application will be deployed using the backend.