Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ jobs:
- name: Build and push Docker images - Server
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./server/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker images - Ui
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./ui/
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
16 changes: 16 additions & 0 deletions .github/workflows/node.js.yml → .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,19 @@ jobs:
with:
branch: gh-pages
folder: dist

deploy2heroku:
runs-on: ubuntu-latest
needs: [test-server,test-ui-unit,test-ui-integration]

if: >-
github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2

- name: Deploy to Heroku
uses: AkhileshNS/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "cssd-highway"
heroku_email: "b8043407@my.shu.ac.uk"
16 changes: 11 additions & 5 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const bodyParser = require("body-parser");
const cors = require("cors");
const cookieSession = require("cookie-session");
const cookieParser = require("cookie-parser");
const swaggerUi = require('swagger-ui-express'),
swaggerDocument = require('./swagger.json')
const swaggerUi = require("swagger-ui-express"),
swaggerDocument = require("./swagger.json");

require("./database");
require("dotenv").config();
Expand All @@ -21,16 +21,22 @@ app.use(
})
);

app.use(cors({ origin: "http://localhost:8080", credentials: true }));
app.use(
cors({
origin: ["http://localhost:8080", "https://jarrodback.github.io"],
credentials: true,
})
);

/**
* Router setup
*/
const authRouter = require("./routes/auth.routes");
const billRouter = require("./routes/bill.routes");
const userRouter = require("./routes/user.routes");
app.get('/api-docs/swagger.json', (req, res) => res.json(swaggerDocument));
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

app.get("/api-docs/swagger.json", (req, res) => res.json(swaggerDocument));
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));

/**
* View Engine setup
Expand Down
2 changes: 1 addition & 1 deletion server/config/db.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
url: "mongodb://localhost:27017/highwaytrackerdb_testing",
},
production: {
url: "mongodb://mongo:27017/highwaytrackerdb",
url: process.env.MONGODB_URI,
},
};
10 changes: 8 additions & 2 deletions ui/src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

const api = class Api {
constructor() {
this.baseUrl = "http://localhost:3000";
this.authUrl = "http://localhost:3000/auth";
this.baseUrl =
process.env.NODE_ENV === "production"
? "https://cssd-highway.herokuapp.com"
: "http://localhost:3000";
this.authUrl =
process.env.NODE_ENV === "production"
? "https://cssd-highway.herokuapp.com/auth"
: "http://localhost:3000/auth";
}

async getAllBills(queryString) {
Expand Down