forked from beyondessential/tupaia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RN-497: meditrak-app-server scaffolding (beyondessential#3905)
* RN-497: Added meditrak-app-server package * RN-497: Added meditrak-api to servers.conf
- Loading branch information
Showing
19 changed files
with
210 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DB_NAME= | ||
DB_PASSWORD= | ||
DB_URL= | ||
DB_PORT= | ||
DB_USER= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @tupaia/meditrak-app-server | ||
|
||
Back end server for the Meditrak app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@hostname = localhost | ||
@port = 8020 | ||
@host = {{hostname}}:{{port}} | ||
@version = v1 | ||
@contentType = application/json | ||
|
||
### /test | ||
GET http://{{host}}/{{version}}/test HTTP/2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import baseConfig from '../../jest.config-ts.json'; | ||
|
||
module.exports = async () => ({ | ||
...baseConfig, | ||
rootDir: '.', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@tupaia/meditrak-app-server", | ||
"version": "0.0.0", | ||
"private": true, | ||
"description": "Backend server for Meditrak-app", | ||
"homepage": "https://github.com/beyondessential/tupaia", | ||
"bugs": { | ||
"url": "https://github.com/beyondessential/tupaia/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/beyondessential/tupaia" | ||
}, | ||
"author": "Beyond Essential Systems <admin@tupaia.org> (https://beyondessential.com.au)", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc -p tsconfig-build.json", | ||
"lint": "eslint . --ext .ts", | ||
"lint:all": "yarn run lint \"src/**/*.{ts,jsx}\"", | ||
"lint:fix": "yarn lint --fix", | ||
"prestart": "npm run -s build", | ||
"start": "node dist", | ||
"start-dev": "LOG_LEVEL=debug ../../scripts/bash/backendStartDev.sh 9998 -ts", | ||
"start-verbose": "LOG_LEVEL=debug npm run start-dev", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "jest --watch" | ||
}, | ||
"dependencies": { | ||
"@tupaia/database": "1.0.0", | ||
"@tupaia/server-boilerplate": "1.0.0", | ||
"dotenv": "^8.2.0", | ||
"winston": "^3.2.1" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/meditrak-app-server/src/__tests__/example.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2020 Beyond Essential Systems Pty Ltd | ||
* | ||
*/ | ||
|
||
describe('Example test', () => { | ||
it('passes a stub test', () => { | ||
expect(1).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2021 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import { TupaiaDatabase } from '@tupaia/database'; | ||
import { MicroServiceApiBuilder } from '@tupaia/server-boilerplate'; | ||
|
||
/** | ||
* Set up express server with middleware, | ||
*/ | ||
export function createApp() { | ||
const app = new MicroServiceApiBuilder(new TupaiaDatabase()).build(); | ||
|
||
return app; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2020 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
export { createApp } from './createApp'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2020 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import * as dotenv from 'dotenv'; | ||
|
||
import http from 'http'; | ||
|
||
import winston from 'winston'; | ||
import { configureWinston } from '@tupaia/server-boilerplate'; | ||
import { createApp } from './app'; | ||
|
||
configureWinston(); | ||
dotenv.config(); // Load the environment variables into process.env | ||
|
||
/** | ||
* Set up app with routes etc. | ||
*/ | ||
const app = createApp(); | ||
|
||
/** | ||
* Start the server | ||
*/ | ||
const port = process.env.PORT || 8020; | ||
http.createServer(app).listen(port); | ||
winston.info(`Running on port ${port}`); | ||
|
||
/** | ||
* Notify PM2 that we are ready | ||
* */ | ||
if (process.send) { | ||
process.send('ready'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
|
||
"compilerOptions": { | ||
"outDir": "dist", | ||
"declaration": true, | ||
"noEmit": false | ||
}, | ||
|
||
"include": ["src/**/*"], | ||
"exclude": ["src/__tests__", "src/@types"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig-ts.json", | ||
|
||
"compilerOptions": { | ||
"typeRoots": ["src/@types", "node_modules/@types", "../../node_modules/@types"], | ||
"noEmit": true | ||
}, | ||
|
||
"include": ["src/**/*", "jest.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash -e | ||
|
||
echo "admin-panel" "lesmis" "psss" "web-frontend" "report-server" "admin-panel-server" "entity-server" "lesmis-server" "central-server" "psss-server" "web-config-server" | ||
echo "admin-panel" "lesmis" "psss" "web-frontend" "admin-panel-server" "central-server" "entity-server" "lesmis-server" "meditrak-app-server" "psss-server" "report-server" "web-config-server" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters