generated from cepdnaclk/eYY-3yp-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from cepdnaclk/dev
Dev
- Loading branch information
Showing
53 changed files
with
1,390 additions
and
863 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,6 @@ jobs: | |
npm install | ||
npm run build | ||
cp .env ./dist | ||
pm2 restart backendserver | ||
chmod +x run.sh | ||
./run.sh | ||
pm2 save |
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "AVR", | ||
"intelliSenseMode": "${default}", | ||
"compilerPath": "", | ||
"cStandard": "${default}", | ||
"cppStandard": "${default}", | ||
"includePath": [], | ||
"compilerArgs": [ | ||
"-g", | ||
"-Os", | ||
"-Wall", | ||
"-Wextra", | ||
"-fpermissive", | ||
"-fno-exceptions", | ||
"-fno-threadsafe-statics", | ||
"-pipe" | ||
] | ||
} | ||
], | ||
"version": 4 | ||
} |
File renamed without changes
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,10 @@ | ||
#!/bin/bash | ||
|
||
# Check if backendserver is running | ||
if pm2 describe backendserver &> /dev/null; then | ||
# If running, restart it | ||
pm2 restart backendserver | ||
else | ||
# If not running, start a new instance | ||
pm2 start ./dist/index.js --name backendserver | ||
fi |
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,22 +1,28 @@ | ||
import { Hub, HubRequest, HubResponse } from "../models/hub.model"; | ||
import { getHubDetails, createHub } from "../services/hub.service"; | ||
import hubService from "../services/hub.service"; | ||
|
||
async function getHub(hubReq: HubRequest): Promise<HubResponse> { | ||
try { | ||
const hub: Hub = await getHubDetails(hubReq.hubId, hubReq.hubKey); | ||
return new HubResponse(hub.mqttUsername, hub.mqttPassword, hub.mqttCA); | ||
} catch (err) { | ||
throw err; | ||
class HubController { | ||
async getHub(hubReq: HubRequest): Promise<HubResponse> { | ||
try { | ||
const hub: Hub = await hubService.getHubDetails( | ||
hubReq.hubId, | ||
hubReq.hubKey | ||
); | ||
return new HubResponse(hub.mqttUsername, hub.mqttPassword, hub.mqttCA); | ||
} catch (err) { | ||
throw err; | ||
} | ||
} | ||
} | ||
|
||
// create hub | ||
async function createHubDetails(newhub: Hub): Promise<Hub> { | ||
try { | ||
const hub: Hub = await createHub(newhub); | ||
return hub; | ||
} catch (err) { | ||
throw err; | ||
// create hub | ||
async createHubDetails(newhub: Hub): Promise<Hub> { | ||
try { | ||
const hub: Hub = await hubService.createHub(newhub); | ||
return hub; | ||
} catch (err) { | ||
throw err; | ||
} | ||
} | ||
} | ||
export { getHub, createHubDetails }; | ||
|
||
export default new HubController(); |
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
Oops, something went wrong.