Skip to content

Commit

Permalink
Merge pull request #420 from ChipLuxury-EWA/docs/tompo/no-decorators-…
Browse files Browse the repository at this point in the history
…js-code-example

Working without decorators -  adding js code example
  • Loading branch information
yoni-rapoport committed Apr 25, 2024
2 parents 873cf37 + cb63e4e commit 2092379
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion docs/docs/working-without-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
If you prefer to work without decorators, or use `remult` in a javascript project (without typescript) you can use the following:

## Entity
```ts{8-16}
::: code-group

```ts [Typescript]
import { Entity, Fields, describeClass } from "remult";

export class Task {
Expand All @@ -20,6 +22,28 @@ describeClass(Task,
completed: Fields.boolean()
})
```

```js [Javascript]
import { Entity, Fields, describeClass } from "remult";

export class Task {
id;
title = '';
completed = false;
}
describeClass(Task,
Entity("tasks", {
allowApiCrud: true
}),
{
id: Fields.uuid(),
title: Fields.string(),
completed: Fields.boolean()
})
```

:::

This is the same entity that is detailed in the [Entities section of the tutorial](https://remult.dev/tutorials/react/entities.html)

## Static BackendMethod
Expand Down

0 comments on commit 2092379

Please sign in to comment.