Global

Methods

App() → {JSX.Element}

Render the main App component.
Source:
Returns:
The JSX element representing the App component.
Type
JSX.Element

Card(_id, name, prompt, photo) → {JSX.Element}

Renders a Card component.
Parameters:
Name Type Description
_id Object The ID of the card.
name string The name of the card.
prompt string The prompt for the card.
photo string The URL of the photo for the card.
Source:
Returns:
The rendered Card component.
Type
JSX.Element

CreatePost() → {void}

Creates a post by generating an imaginative image using DALL-E AI and sharing it with the community.
Source:
Returns:
Type
void

FormField(labelName, type, name, placeholder, value, handleChange, isSurpriseMe, handleSurpriseMe) → {ReactNode}

Renders a form field component.
Parameters:
Name Type Description
labelName string The name of the label for the field.
type string The type of the input field.
name string The name of the input field.
placeholder string The placeholder text for the input field.
value string The value of the input field.
handleChange function The event handler for input field changes.
isSurpriseMe boolean Indicates if the "Surprise me" button should be shown.
handleSurpriseMe function The event handler for the "Surprise me" button click.
Source:
Returns:
The rendered form field component.
Type
ReactNode

Loader() → {JSX.Element}

Render a loader component.
Source:
Returns:
The loader component.
Type
JSX.Element

connectDB(url) → {Promise}

Connects to the MongoDB database using the provided URL.
Parameters:
Name Type Description
url string The URL of the MongoDB database.
Source:
Returns:
A promise that resolves when the connection is successful, or rejects with an error message if the connection fails.
Type
Promise

getRandomPrompt(prompt) → {string}

Generates a random prompt different from the given prompt.
Parameters:
Name Type Description
prompt string The prompt to compare against.
Source:
Returns:
A random prompt different from the given prompt.
Type
string

(async) startServer() → {Promise.<void>}

Starts the server.
Source:
Returns:
- A promise that resolves when the server has started.
Type
Promise.<void>