Skip to content

Commit 72a533e

Browse files
committed
Address ALL PR comments
1 parent bb5b5e0 commit 72a533e

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

docs/getting-started/first-harper-app.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,36 @@ Harper automatically creates your Book table and REST endpoints. You now have a
3939

4040
## Test Your API
4141
### Create a book:
42-
```bash
43-
curl -X POST -H "Content-Type: application/json" \
44-
-d '{"title": "The Great Gatsby", "author": "F. Scott Fitzgerald", "publishedYear": 1925, "genre": "Fiction"}' \
45-
http://localhost:9926/Book
42+
```javascript
43+
const response = await fetch('http://localhost:9926/Book', {
44+
method: 'POST',
45+
headers: { 'Content-Type': 'application/json' },
46+
body: JSON.stringify({
47+
title: "The Great Gatsby",
48+
author: "F. Scott Fitzgerald",
49+
publishedYear: 1925,
50+
genre: "Fiction"
51+
})
52+
});
53+
const newBook = await response.json();
4654
```
4755

4856
### Get all books:
49-
```bash
50-
curl http://localhost:9926/Book
57+
```javascript
58+
const books = await fetch('http://localhost:9926/Book').then(r => r.json());
5159
```
5260

5361
### Query by indexed fields:
54-
```bash
55-
curl "http://localhost:9926/Book?author=F. Scott Fitzgerald"
56-
curl "http://localhost:9926/Book?genre=Fiction"
57-
curl "http://localhost:9926/Book?publishedYear=1925&select(title,author)"
62+
```javascript
63+
const authorBooks = await fetch('http://localhost:9926/Book?author=Chimamanda')
64+
.then(r => r.json());
65+
const fictionTitles = await fetch('http://localhost:9926/Book?genre=Fiction&select(title,author)')
66+
.then(r => r.json());
5867
```
5968

6069
### Get a specific book:
6170
```bash
62-
curl http://localhost:9926/Book/BOOK_ID_HERE
71+
const book = await fetch(`http://localhost:9926/Book/${bookId}`).then(r => r.json());
6372
```
6473
6574
## What You Get Automatically
@@ -73,11 +82,11 @@ Harper provides enterprise-grade features out of the box:
7382
- **Error handling** and proper HTTP status codes
7483
7584
## Add Custom Logic (Optional)
76-
Only when you need custom business logic should you add code. Create a `resources.js` file to extend the default behavior:
85+
Only when you need custom business logic should you add code. Create a `resources.js` file to define a new resource and add custom functionality:
7786
7887
```js
7988
export class Books extends Resource {
80-
// Add custom validation or computed fields
89+
const { Book } = tables;
8190
post(data) {
8291
if (!data.title || !data.author) {
8392
return { error: "Title and author are required" };
@@ -88,7 +97,7 @@ export class Books extends Resource {
8897
data.decade = Math.floor(data.publishedYear / 10) * 10;
8998
}
9099

91-
return this.table.post(data);
100+
return Book.post(data);
92101
}
93102
}
94103
```

docs/getting-started/harper-concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Harper components are a core Harper concept defined as flexible JavaScript based
88
A key aspect to components are their extensibility; components can be built on other components. For example, a [Harper Application](https://docs.harperdb.io/docs/developers/applications) is a component that uses many other components. The [application template](https://github.com/HarperDB/application-template) demonstrates many of Harper's built-in components such as [rest](https://docs.harperdb.io/docs/developers/components/built-in#rest) (for automatic REST endpoint generation), graphqlSchema (for table schema definitions), and many more.
99

1010
## Applications
11-
Applications are a subset of components that cannot be used directly and must depend on other extensions. Examples include defining schemas (using [graphqlSchema](https://docs.harperdb.io/docs/developers/components/built-in#graphqlschema) built-in extension), defining custom resources (using jsResource built-in extension), hosting static files (using static built-in extension), enabling REST querying of resources (using rest built-in extension), and running Next.js, Astro, or Apollo applications through their respective extensions.
11+
Applications are a subset of components that cannot be used directly and must depend on other extensions. Examples include defining schemas (using [graphqlSchema](https://docs.harperdb.io/docs/developers/components/built-in#graphqlschema) built-in extension), defining custom resources (using [jsResource](https://docs.harperdb.io/docs/developers/components/built-in#jsresource) built-in extension), hosting static files (using [static](https://docs.harperdb.io/docs/developers/components/built-in#static) built-in extension), enabling REST querying of resources (using [rest](https://docs.harperdb.io/docs/developers/components/built-in#rest) built-in extension), and running [Next.js](https://github.com/HarperDB/nextjs), [Astro](https://github.com/HarperDB/astro), or [Apollo](https://github.com/HarperDB/apollo) applications through their respective extensions.
1212

1313
## Resources
1414
Resources in Harper encompass databases, tables, and schemas that store and structure data within the system. The concept is central to Harper's data management capabilities, with custom resources being enabled by the built-in jsResource extension. Resources represent the data layer of the Harper ecosystem and provide the foundation for data operations across applications built with the platform.

docs/getting-started/install-harper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Install Harper
22

3-
There are three ways to install a Harper instance: using a package manager like NPM, deploying it as a Docker container, and offline installation. Below is a step-by-step tutorial for each method.
3+
There are three ways to install a Harper instance: using a package manager like npm, deploying it as a Docker container, and offline installation. Below is a step-by-step tutorial for each method.
44

55
## Installing via NPM
66
Before you begin, ensure you have [Node.js](https://nodejs.org/) LTS version or newer. Node.js comes with npm, which will be used to install Harper.

0 commit comments

Comments
 (0)