-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need More Clarification #2
Comments
Hi Dilavar-Me4u, const PORT = process.env.PORT || 9000; Well, what is process.env.x? 'x' is a environment variable whose value is set outside the program, typically through functionality built into the os or microservices. VITE_BASE_URL=<URL> So now we understand at the conceptual level how the client-side and the server-side communicate with each other. As an ai chat application, the application use OpenAI and Chat-Engine APIs (Application Programming Interfaces).
Now, create .env file for both server and client directory. let's start server-side, PORT=<PORT>
OPENAI_API_KEY=<OPEN_AI_API_KEY>
CE_PROJECT_ID=<CHAT_ENGINE_PROJECT_ID>
CE_PRIVATE_KEY=<CHAT_ENGINE_PRIVATE_KEY>
CE_BOT_USER_NAME=<SYSTEM_AI_BOT_USER_NAME>
CE_BOT_USER_SECRET=<SYSTEM_AI_BOT_USER_SECRET> If you dont set PORT the port will be 9000. (ofc, if you want to define a port, be aware it is not the port that used for the client-side). Now, in our client .env file we have only to define two environment variables, VITE_BASE_URL=<SERVER_URL>
VITE_PROJECT_ID=<CHAT_ENGINE_PROJECT_ID> In our case, you run the web-application locally, se our VITE_BASE_URL is none but http://localhost:<PORT> where the PORT comes from the server .env file. (I hope you remember, If you didn't defined it, the port will be 9000 as a default). Now we are ready to run our application, npm i in order to download the required packages. npm start This command purpose is to run the server. npm run dev btw, sorry for the delay, I saw your issue just now. |
Thank you very much for the detailed explanation. I hope this will be helpful to many people. Great Job!!! |
My pleasure, feel free to open the issue if needed. |
Questions:
The text was updated successfully, but these errors were encountered: