#!/usr/bin/env bash

set -ex

rm -rf app

mkdir app

pushd app
  npx express-generator
popd

pushd app
  npm install
  npm install pug

  npm install monk
popd

pushd app
  # (1) overwrite the original “app.js” in the Express app directory with the “app.js” we provided.
  # (2) overwrite the original “users.js” in ./routes with the same file that we provided;
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/app.js app.js
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/users.js routes/users.js

  # (3) move “externalJS.js” to ./public/javascripts;
  # (4) move “style.css” to ./public/stylesheets;
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/externalJS.js public/javascripts/externalJS.js
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/style.css public/stylesheets/style.js


  # (5) overwrite the original “index.pug” and “layout.pug” with the same files that we provided;
  # (6) move “logo.png” to ./public/images.
  rm -rf views/*.jade
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/index.pug views/index.pug
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/layout.pug views/layout.pug
  cp /home/logic/_workspace/COMP3322A-lab6/docs/lab6_materials/logo.png ./public/images/logo.png

  node app.js

popd
