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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ dist
npm-debug.log*
yarn-debug.log*
yarn-error.log*


frontend/server.key
frontend/server.cert

backend/server.key
backend/server.cert
9 changes: 3 additions & 6 deletions backend/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier"
],
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
Expand All @@ -14,6 +11,6 @@
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-explicit-any": "off"
}
}
}
6 changes: 3 additions & 3 deletions backend/.mocharc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"timeout" : 20000,
"timeout": 20000,
"extension": ["ts"],
"spec": "test/**/*.test.ts",
"require": "ts-node/register",
"file" : ["test/setup.ts"]
}
"file": ["test/setup.ts"]
}
2 changes: 1 addition & 1 deletion backend/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"printWidth": 100,
"tabWidth": 2,
"singleQuote": true
}
}
79 changes: 51 additions & 28 deletions backend/env.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,58 @@
{
"BACKEND_PORT" : {
"type" :"number",
"default" : 5051
},
"ALLOWED_ORIGIN" : {
"type" : "object",
"default" : ["http://localhost:3000", "http://localhost:3000/", "http://localhost:3005", "http://localhost:3005/", "http://localhost:3008", "http://localhost:3008/", "http://localhost:5050", "http://localhost:5050/", "http://localhost:4040", "http://localhost:4040/"]
},
"MONGO_USERNAME": {
"type" : "string",
"default" : "rems-admin-pims-root"
},
"BACKEND_PORT": {
"type": "number",
"default": 5051
},
"ALLOWED_ORIGIN": {
"type": "object",
"default": [
"http://localhost:3000",
"http://localhost:3000/",
"http://localhost:3005",
"http://localhost:3005/",
"http://localhost:3008",
"http://localhost:3008/",
"http://localhost:5050",
"http://localhost:5050/",
"http://localhost:4040",
"http://localhost:4040/"
]
},
"MONGO_USERNAME": {
"type": "string",
"default": "rems-admin-pims-root"
},

"MONGO_PASSWORD" :{
"type" : "string",
"default" : "rems-admin-pims-password"
},
"MONGO_PASSWORD": {
"type": "string",
"default": "rems-admin-pims-password"
},

"MONGO_URL" : {
"type" : "string",
"default" : "mongodb://localhost:27017/pims"
},
"MONGO_URL": {
"type": "string",
"default": "mongodb://localhost:27017/pims"
},

"AUTH_SOURCE" :{
"type" : "string",
"default" : "admin"
},
"AUTH_SOURCE": {
"type": "string",
"default": "admin"
},

"REMS_ADMIN_BASE" : {
"type" : "string",
"default" : "http://localhost:8090"
}
"REMS_ADMIN_BASE": {
"type": "string",
"default": "http://localhost:8090"
},

"HTTPS_KEY_PATH": {
"type": "string",
"default": "server.key"
},
"HTTPS_CERT_PATH": {
"type": "string",
"default": "server.cert"
},
"USE_HTTPS": {
"type": "boolean",
"default": false
}
}
2 changes: 1 addition & 1 deletion backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"mongodb-memory-server": "^8.12.1",
"nock": "^13.2.9",
"nodemon": "^2.0.20",
"prettier": "^2.0.5",
"prettier": "2.8.8",
"sinon": "^15.0.3",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
Expand Down
16 changes: 15 additions & 1 deletion backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const app = express();
import cors from 'cors';
import mongoose from 'mongoose';
import env from 'var';
import https from 'https';
import fs from 'fs';

//middleware and configurations
import bodyParser from 'body-parser';
Expand All @@ -20,9 +22,21 @@ async function main() {

app.use(bodyParser.urlencoded({ extended: false }));
app.use(cors(options));
app.listen(port, () => console.log(`Listening on port ${port}`));
app.use('/doctorOrders', doctorOrders);

let server: any = app;

if (env.USE_HTTPS) {
console.log('Enabling HTTPS HTTPS');
const credentials = {
key: fs.readFileSync(env.HTTPS_KEY_PATH),
cert: fs.readFileSync(env.HTTPS_CERT_PATH)
};
server = https.createServer(credentials, app);
}

server.listen(port, () => console.log(`Listening on port ${port}`));

const mongoHost = env.MONGO_URL;

await mongoose.connect(mongoHost, {
Expand Down
1 change: 1 addition & 0 deletions backend/test/simple.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import router from '../src/routes/doctorOrders';

describe('help', () => {
it.skip('should fail', () => {
throw 'Errrrr';
Expand Down
14 changes: 3 additions & 11 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -20,12 +16,8 @@
"outDir": "dist",
"jsx": "react-jsx",
"paths": {
"*": [
"./src/typings/*"
]
"*": ["./src/typings/*"]
}
},
"include": [
"src"
]
"include": ["src"]
}
16 changes: 14 additions & 2 deletions frontend/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"ALLOWED_ORIGIN" : {
"type" : "object",
"default" : ["http://localhost:3000", "http://localhost:3000/", "http://localhost:3005", "http://localhost:3005/", "http://localhost:5050", "http://localhost:5050/", "http://localhost:4040", "http://localhost:4040/"]
"default" : ["http://localhost:3000", "https://localhost:3000/", "http://localhost:3005", "https://localhost:3005/", "http://localhost:5050", "https://localhost:5050/", "http://localhost:4040", "https://localhost:4040/"]
},
"MONGO_USERNAME": {
"type" : "string",
Expand Down Expand Up @@ -35,6 +35,18 @@
"PORT" : {
"type" :"number",
"default" : 5050
}
},

"SSL_KEY_FILE": {
"type": "string",
"default": "server.key"
},
"SSL_CRT_FILE": {
"type": "string",
"default": "server.cert"
},
"USE_HTTPS": {
"type": "boolean",
"default": false
}
}