Basic message board web app built with Express.js for the backend, Vue.js for the frontend, and BootstrapVue for styling
GitHub repo: https://github.com/rlrh/cs3219-otot-task-b
This is a monorepo that has both the backend and frontend. The project has been preconfigured for Travis CI, and both Serverless and Heroku deployment. Serverless deployment only deploys the backend API without the frontend. Heroku deployment combines the backend and frontend into a single app.
Live demo deployed on Heroku: https://cs3219-a0180340u-otot-task-b.herokuapp.com/
Note: the Heroku app does not use the AWS Lambda API gateway
Live API deployed on AWS Lambda: https://yrtw21jxmg.execute-api.us-east-1.amazonaws.com/master
/messages
GET, POST (body JSON:{ text: <your_message_text> }
)/messages/:messageId
GET, DELETE, PUT (body JSON:{ text: <your_message_text> }
)/users
GET/users/:userId
GET/session
GET
Setup MongoDB databases for testing and production and copy their URLs into the .env
file:
PROD_DATABASE_URL=<your_mongodb_production_database_url>
TEST_DATABASE_URL=<your_mongodb_test_database_url>
npm install
cd frontend
npm install
cd ..
npm run dev
- Backend is at
http://localhost:5000
, frontend is athttp://localhost:8080
by default - Backend only:
npm run backend
- Frontend only:
npm run frontend
npm run test
npm run heroku-postbuild
npm run start
Live app is at http://localhost:5000
- Fork this repo.
- Setup MongoDB production and test databases according to part 1 above (if you have not).
- Create Travis CI and AWS accounts.
- In AWS, take note of your credentials.
- In Travis CI, select your repo, click
Settings
, scroll down to theEnvironment Variables
section, and add two variables:
Name: AWS_ACCESS_KEY_ID, Value: Access Key Id of the IAM user
Name: AWS_SECRET_ACCESS_KEY, Value: Secret Access Key of the IAM user
- Create a pull request in GitHub, or trigger a build in Travis CI.
- In Travis CI, select your repo, and in the job log look for the URL of the deployed endpoint:
...
endpoints:
ANY - https://yrtw21jxmg.execute-api.us-east-1.amazonaws.com/master/
ANY - https://yrtw21jxmg.execute-api.us-east-1.amazonaws.com/master/{proxy+}
...
- Copy the URL without the trailing slash into
frontend/vue.config.js
devServer.proxy.target
:
...
devServer: {
proxy: {
'^/': {
target: 'https://yrtw21jxmg.execute-api.us-east-1.amazonaws.com/master',
changeOrigin: true
}
}
}
...
- Run the frontend locally:
npm run frontend
and go to:http://localhost:8080
- Fork this repo
- Setup MongoDB production and test databases according to part 1 above (if you have not)
- Create an app on Heroku Dashboard and connect it to your GitHub repo by following instructions here
- Setup Travis CI with included
.travis.yml
file by following instructions here - Setup CI/CD workflow by enabling
Automatic Deploys from GitHub
andWait for CI to pass before deploy
on your app in Heroku Dashboard - Heroku will deploy the app automatically after Travis CI passes tests