nafees87n / codebox

codeBox RCE is a service that provides a remote environment to run your code in. Execution occurs in a containerized space. The API supports programming in 3 languages (Python, Javascript and C++), potentially extendable to support more.
http://codebox.herokuapp.com/
MIT License
9 stars 9 forks source link

Move hardcoded variables into a separate constant provider file #5

Closed nafees87n closed 3 years ago

nafees87n commented 3 years ago

Feel free to use your own judgement after looking at the code. Reach out to us for any clarification.

kailash360 commented 3 years ago

I want to work on this issue

nafees87n commented 3 years ago

Sure Go ahead @kailash360

kailash360 commented 3 years ago

@nafees87n , should I put regex expressions for import in the constants file? For now, the constants are mentioned below. Kindly suggest if I am missing anything or need to add others. image

nafees87n commented 3 years ago

@kailash360 You can make two objects in the constant file you are working on APP_CONST and SERVER_CONST. The APP_CONST should contain frontend constants and SERVER_CONST all constants of the server and the executor.

Make const for different URLs like SERVER_URL and we can specify the entire URL there, no need to specify the port separately. Similarly, do this for the client URL and the Github links.

nafees87n commented 3 years ago

Make sure to test the entire application after the changes. Check the docs for the process to start the development server using docker. Feel free to ask if you are stuck anywhere.

@kailash360 Don't forget to pull changes from main as there have been some changes after you have started working.

kailash360 commented 3 years ago

Sir, the server, client and executor cannot make an import outside their folder. So, it is difficult to keep a single file in the root directory, that can hold all the constants. I made constants file for each of the folders and it worked. Will this suffice?

kailash360 commented 3 years ago

I have tested the project using the above method and it is working fine.

nafees87n commented 3 years ago

Sir, the server, client and executor cannot make an import outside their folder. So, it is difficult to keep a single file in the root directory, that can hold all the constants. I made constants file for each of the folders and it worked. Will this suffice?

Okay. Let's keep it this way for now. Later we could create package.json in the root to locally link it as an npm package in the subfolders.

kailash360 commented 3 years ago

I have created PR #9 for this issue