Get Started
Installation
This guide will walk you through the process of setting up Rapture in your development environment, allowing you to start building dynamic and engaging web applications.
Prerequisites
Before you begin the installation process, make sure you have the following prerequisites in place:
Node.js and npm: Rapture requires Node.js and npm to manage dependencies and build your applications. If you don't have them installed, you can download them from the official Node.js website.
To get started with Rapture, follow these steps:
Create a New Project Directory: Create a new directory for your Rapture project.
Navigate to the Project Directory: Open your terminal and navigate to the newly created project directory using the
cd
command:
cd
path/to/your/project
Copy
Initialize Your Project: Initialize your project by running the following command:
npm
init -y
Copy
Install Rapture Package: Install the Rapture package using npm:
npm
install @rapture/ui
Copy
This will install the necessary Rapture components and dependencies into your project.
Now that you've installed Rapture, you can start using it in your application. Here's a basic example of how to create a simple Rapture app:
Create an HTML File: Create a new HTML file, e.g.,
index.html
.
Add Rapture Script: Add the following code to your HTML file to include the Rapture library:
HTML
// api.js
export async function fetchMessages(conversationId, page = 1, limit = 10) {
const response = await fetch(
`/api/messages?conversation_id=${conversationId}&page=${page}&limit=${limit}`
);
if (!response.ok) {
throw new Error('Failed to fetch messages');
}
const data = await response.json();
return data;
}
Copy
Replace "path-to-rapture/rapture.min.js"
with the actual path to the Rapture library in your project.