This is an express RESTful API project, using Node.js and Express, written in JavaScript.
- morgan- HTTP request logger middleware for Node.js
- dotenv- Loads environment variables from
.env
file intoprocess.env
- cors- CORS provides a Connect/Express middleware that can be used to enable CORS with various options.
- openai- This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript.
- nodemon- Helps develop node.js based application by automatically restarting the node server when it detects application file changes.
yarn
yarn dev
The server runs a simple Express API server
/
returnsstatus: ok
/openai
talks to OpenAI server with API key taken from Environment variable, and initiates a chat completions API call, with function added in tools, to get a path to navigate to in a frontend application- Unknown endpoints are handled in a middleware file.
src\
|--routes\ # Routes
|--utils\ # Utility files
|--app.js # Express app
|--index.js # App entry point