Skip to content

Commit

Permalink
Set server error
Browse files Browse the repository at this point in the history
  • Loading branch information
ospfranco committed Nov 18, 2024
1 parent c2190fd commit 33404b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
19 changes: 14 additions & 5 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import RNRestart from 'react-native-restart';
import Share from 'react-native-share';
import 'reflect-metadata';
import {createLargeDB, queryLargeDB} from './Database';
import {setServerResults, startServer, stopServer} from './server';
import {
setServerError,
setServerResults,
startServer,
stopServer,
} from './server';
import {constantsTests} from './tests/constants.spec';
import {registerHooksTests} from './tests/hooks.spec';
import {blobTests, dbSetupTests, queriesTests, runTests} from './tests/index';
Expand All @@ -40,10 +45,14 @@ export default function App() {
constantsTests,
reactiveTests,
tokenizerTests,
).then(results => {
setServerResults(results as any);
setResults(results);
});
)
.then(results => {
setServerResults(results as any);
setResults(results);
})
.catch(e => {
setServerError(e);
});

startServer();

Expand Down
7 changes: 6 additions & 1 deletion example/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let results: any[] = [];
const server = new BridgeServer('http_service', true);

server.get('/ping', async (_req, _res) => {
// console.log("🟦 🟦🟦🟦🟦🟦🟦 🟦 Received request for '/ping'");
return {message: 'pong'};
});

Expand All @@ -23,5 +22,11 @@ export function stopServer() {
}

export function setServerResults(r: any[]) {
console.log('Setting server results');
results = r;
}

export function setServerError(e: any) {
console.log('Setting server error');
results = e;
}

0 comments on commit 33404b5

Please sign in to comment.