This API allows you to generate random quotes based on a given input and language.
These instructions will help you to get a copy of the project up and running on your local machine for development and testing purposes.
- A Vercel account
- A GitHub or GitLab repository for the project
- OpenAI API key
- npm (comes with Node.js)
Clone the repository to your local machine
git clone https://github.com/ryarturogi/random-quote-generator-api.git
Go to the project directory
cd random-quote-generator-api
Install the dependencies
npm install
Set your OpenAI API key in the .env file
NEXT_PUBLIC_OPENAI_API_KEY: '<YOUR_API_KEY>',
NEXT_PUBLIC_OPENAI_API_URL: 'https://api.openai.com/v1/completions'
Start the server
npm run dev or yarn dev
The API will be available at http://localhost:3000/api/generate-quote.
-
Send a
POST
request to the/api/generate-quote
endpoint with a JSON payload containing theinput
field and thelanguage
field. -
The response will be a JSON object containing the generated quote.
{
"quote": "The quote generated by the API",
"language": "english" // any languague
}
To deploy the API to a production environment on Vercel, you should consider the following steps:
- Connect your repository to your Vercel account
- Set your OpenAI API key in the
.env
file as an environment variable in Vercel - Use a logging service such as Loggly or Splunk to collect and analyze the logs
- Use a monitoring service such as New Relic or Prometheus to monitor the performance of the API
- Ricardo Arturo Guillen I. - RyArturoGI
This project is licensed under the MIT License - see the [MIT]((https://github.com/ryarturogi/random-quote-generator-api/LICENSE) file for details