Skip to content

Commit

Permalink
docs: fix javascript usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
edcolvin committed Nov 12, 2020
1 parent bce4f65 commit d202c56
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/usage-with-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ typeorm.createConnection({
##### entity/Category.js

```typescript
module.exports = {
var EntitySchema = require("typeorm").EntitySchema;

module.exports = new EntitySchema({
name: "Category", // Will use table name `category` as default behaviour.
tableName: "categories", // Optional: Provide `tableName` property to override the default behaviour for table name.
columns: {
Expand All @@ -72,13 +74,15 @@ module.exports = {
type: "varchar"
}
}
};
});
```

##### entity/Post.js

```typescript
module.exports = {
var EntitySchema = require("typeorm").EntitySchema;

module.exports = new EntitySchema({
name: "Post", // Will use table name `post` as default behaviour.
tableName: "posts", // Optional: Provide `tableName` property to override the default behaviour for table name.
columns: {
Expand All @@ -102,7 +106,7 @@ module.exports = {
cascade: true
}
}
};
});
```

You can checkout this example [typeorm/javascript-example](https://github.com/typeorm/javascript-example) to learn more.

0 comments on commit d202c56

Please sign in to comment.