This is a basic TypeScript Express application that utilizes Node.js for server-side functionality and integrates with Openai. It is configured with Nodemon for automatic server restarts during development and uses ts-node for TypeScript execution.
Before you begin, ensure you have the following installed on your machine:
- Clone the repository to your local machine:
git clone https://github.com/c99rahul/ts-node-express.git
- Navigate to the project directory:
cd openai-ts-expressjs
- Install the project dependencies:
pnpm install
- Create a
.env
file in the root of the project and add your Openai API key:
OPENAI_API_KEY=your-api-key-here
To start the server in development, run the following command:
pnpm dev
The server will be available at http://localhost:4000
.
Project structure:
.
├── src
│ ├── controllers
│ │ └── chat.ts
│ ├── routes
│ │ └── index.ts
│ └── index.ts
├── .env
├── .gitignore
├── config.json
├── package.json
├── pnpm-lock.yaml
├── README.md
└── tsconfig.json
This project is open source and available under the MIT License.