Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadim Ritter committed Aug 27, 2024
1 parent 21a38a0 commit 4a9d9f8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
9 changes: 9 additions & 0 deletions client/src/services/api-services/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,17 @@ export function createApiInterceptor(){
let redirectRoute: string = "/";
if(window.location.pathname != null){
redirectRoute = window.location.pathname;
console.log(redirectRoute)
}

if(ENV.BASE_PATH != "" && ENV.BASE_PATH != null && redirectRoute.includes(ENV.BASE_PATH)){
console.log("it got here")
redirectRoute.replace(ENV.BASE_PATH, "");
}

console.log(redirectRoute)


authStore.redirectRoute = redirectRoute;

navigateTo("/");
Expand Down
32 changes: 23 additions & 9 deletions server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,53 @@ import {LOG} from "./logging/logger";
import {apiRequestLogger} from "./logging/api-request-logger";
import * as ENV from "./config/envConfig";


const app: Express = express();

const port: string = ENV.SERVER_PORT;
const path: string = __dirname + "/views/";

//get environemnt mode for local dev and set cors options
LOG.info("env mode: " + ENV.NODE_ENV);
const mainIndexPath: string = path + "index.html";

//get environment mode for local dev and set cors options
if(ENV.NODE_ENV === "dev"){
app.use(cors(getCorstOptions()))
// app.use(cors())
}


//static files config
app.use(express.static(path));
app.use(bodyParser.json());


//middleware
app.use(apiRequestLogger);


//api routes
app.use(authorizationRoutes);
app.use(routes);


app.get(ENV.BASE_PATH + "/", (req: Request, res: Response) => {
res.sendFile(path + "index.html");
//static files routes
app.get("/", (req: Request, res: Response) => {
res.sendFile(mainIndexPath);

});

app.get("*", (req: Request, res: Response) => {
res.sendFile(path + "index.html");
res.sendFile(mainIndexPath);
});

app.listen(port, () => {
LOG.info(`⚡️[server]: Server is running at 0.0.0.0 ${port}`);
//server startup
app.listen(port, async () => {
LOG.info(`⚡️[server]: Server is running at : ${port}`);
LOG.info("env mode: " + ENV.NODE_ENV);
LOG.info("is seb-server integrated: " + ENV.SEB_SERVER_INTEGRATED_MODE);
LOG.info("base path: " + ENV.BASE_PATH);
LOG.info(`screen-proctoring-server: ${ENV.PROCTOR_SERVER_URL}${ENV.PROCTOR_SERVER_PORT}`)
});


function getCorstOptions(): object{
return {
origin: `${ENV.DEV_SERVER_URL}:${ENV.DEV_SERVER_PORT}`,
Expand Down

0 comments on commit 4a9d9f8

Please sign in to comment.