Skip to content

Commit ea6c496

Browse files
fix quick start info
1 parent f963b52 commit ea6c496

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

website/docs/quick-start-tutorial.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ cat src/view.ts
104104

105105
You'll see something like:
106106

107-
```javascript
107+
```typescript
108108
export default function (model) {
109109
return `
110110
<div>
@@ -147,13 +147,39 @@ Watching for changes...
147147
Open your browser and visit:
148148

149149
- **Component endpoint**: http://localhost:3030/hello-world?userId=1
150-
- **Component info**: http://localhost:3030/hello-world/~info
150+
- **Component info**: http://localhost:3030/hello-world/1.0.0/~info
151151

152152
**Important**: The generated component requires parameters. If you get an error about "missing mandatory parameters", check the component info page to see what parameters are required.
153153

154154
### Check Component Information
155155

156-
Visit http://localhost:3030/hello-world/~info to see detailed information about your component, including all available parameters and which ones are mandatory.
156+
Visit http://localhost:3030/hello-world/1.0.0/~info to see detailed information about your component, including all available parameters and which ones are mandatory.
157+
158+
### Understanding Different Component URLs
159+
160+
OpenComponents provides several ways to access your component:
161+
162+
1. **JSON API** (for programmatic access):
163+
164+
```
165+
http://localhost:3030/hello-world?userId=1
166+
```
167+
168+
Returns the component data as JSON
169+
170+
2. **Component Info Page** (for development/testing):
171+
172+
```
173+
http://localhost:3030/hello-world/1.0.0/~info
174+
```
175+
176+
Shows component details with live preview
177+
178+
3. **Direct Preview** (for embedding):
179+
```
180+
http://localhost:3030/hello-world/1.0.0/~preview
181+
```
182+
Shows just the rendered component
157183

158184
Or use the CLI preview:
159185

@@ -171,7 +197,7 @@ oc preview http://localhost:3030/hello-world
171197

172198
## Step 4: Customize Your Component
173199

174-
Let's modify the component to make it more interesting. Edit the `server.js` file:
200+
Let's modify the component to make it more interesting. Edit the `server.ts` file:
175201

176202
```javascript
177203
export const data = (context, callback) => {
@@ -197,7 +223,7 @@ function getTimeBasedGreeting() {
197223
}
198224
```
199225

200-
Update the template (`template.js`):
226+
Update the template (`view.ts`):
201227

202228
```javascript
203229
export default function (model) {
@@ -401,8 +427,9 @@ Update your HTML to use the production registry:
401427
### Understanding Your Component
402428

403429
The generated component demonstrates several OpenComponents features:
430+
404431
- **Parameter Handling**: Shows how to define and use mandatory/optional parameters
405-
- **Server Actions**: The "funFact" button demonstrates client-server communication
432+
- **Server Actions**: The "funFact" button demonstrates client-server communication
406433
- **CSS Modules**: Scoped styling that won't conflict with other components
407434
- **TypeScript**: Type safety for better development experience
408435
- **Client-side Interactivity**: Event handling within components
@@ -420,7 +447,7 @@ Now that you've created your first component, explore these advanced topics:
420447
### For Beginners
421448

422449
- **Always run `oc dev` from the directory containing your components**, not from inside a component
423-
- **Check component info** at `/~info` to see required parameters
450+
- **Check component info** at `/~info` to see required parameters
424451
- **Use the browser console** to debug client-side issues
425452
- **Test both client-side and server-side rendering** to ensure compatibility
426453

0 commit comments

Comments
 (0)