Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
remove prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
iadibar committed Feb 14, 2024
1 parent a8dfac7 commit 1ca6b0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions portal/mock-server/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Request, Response, Router as CoreRouter } from 'express-serve-static-co
const router: CoreRouter = Router();


router.post('/qujata-api/analyze', async (req: Request, res: Response) => {
router.post('/analyze', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
const data = { test_suite_id: '1' };

Expand All @@ -13,38 +13,38 @@ router.post('/qujata-api/analyze', async (req: Request, res: Response) => {
}, 1500);
});

router.get('/qujata-api/algorithms', async (req: Request, res: Response) => {
router.get('/algorithms', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
const data = (await import('./algorithms.json')).default;
setTimeout(() => {
res.json(data);
}, 1500);
});

router.get('/qujata-api/iterations', async (req: Request, res: Response) => {
router.get('/iterations', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
const data = (await import('./iterations.json')).default;
setTimeout(() => {
res.json(data);
}, 1500);
});

router.get('/qujata-api/test_suites/:testSuiteId', async (req: Request, res: Response) => {
router.get('/test_suites/:testSuiteId', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
const data = (await import('./test.json')).default;
setTimeout(() => {
res.json(data);
}, 1500);
});

router.put('/qujata-api/test_suites/:testSuiteId', async (req: Request, res: Response) => {
router.put('/test_suites/:testSuiteId', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
setTimeout(() => {
res.status(200).send();
}, 1500);
});

router.delete('/qujata-api/test_suites/:testSuiteId', async (req: Request, res: Response) => {
router.delete('/test_suites/:testSuiteId', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
setTimeout(() => {
res.status(200).send();
Expand Down
13 changes: 6 additions & 7 deletions portal/src/app/apis.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const testSuites = 'test_suites';
const prefix = 'qujata-api';

export const APIS: { [key in keyof typeof API_URLS]: string } = {
analyze: `${prefix}/analyze`,
algorithms: `${prefix}/algorithms`,
iterations: `${prefix}/iterations`,
testRunResults: `${prefix}/${testSuites}/:testSuiteId`,
editExperiment: `${prefix}/${testSuites}/:testSuiteId`,
deleteExperiment: `${prefix}/${testSuites}/:testSuiteId`,
analyze: 'analyze',
algorithms: 'algorithms',
iterations: 'iterations',
testRunResults: `${testSuites}/:testSuiteId`,
editExperiment: `${testSuites}/:testSuiteId`,
deleteExperiment: `${testSuites}/:testSuiteId`,
};

enum API_URLS {
Expand Down
2 changes: 1 addition & 1 deletion portal/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = (app) => {
return;
}
app.use(
['/analyze', '/algorithms', '/iterations', '/qujata-api'],
['/analyze', '/algorithms', '/iterations', '/qujata-api', '/test_suites/*'],
createProxyMiddleware({
target,
changeOrigin: true,
Expand Down

0 comments on commit 1ca6b0c

Please sign in to comment.