Skip to content

Commit

Permalink
Fix naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
manomintis authored and manomintis committed Feb 21, 2024
1 parent 3541bc6 commit 48acda2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ node ace configure adonis-api-resources
Generate a new resource:

```sh
node ace make:resource UserResource
node ace make:resource user
```


Expand All @@ -46,7 +46,7 @@ Edit newly generated app/resources/users_resource.ts to create output you need.
Import your generated resource before using it, i.e. in a controller:

```typescript
import UsersResource from '#resources/users_resource'
import UserResource from '#resources/user_resource'
```


Expand All @@ -60,14 +60,14 @@ return user
Use the your generated resource instead:

```typescript
return new UsersResource(user).refine()
return new UserResource(user).refine()
```


You may also use arrays of models, with resources:

```typescript
return new UsersResource(users).refine()
return new UserResource(users).refine()
```

That's it. Enjoy yourself!
Expand Down
2 changes: 1 addition & 1 deletion stubs/main.stub
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#var className = generators.modelName(entity.name)}}
{{#var fileName = string(className).snakeCase().removeSuffix('resource').plural().suffix('_resource').ext('.ts').toString()}}
{{#var fileName = string(entity.name).snakeCase().removeSuffix('resource').suffix('_resource').ext('.ts').toString()}}
{{{
exports({
to: app.makePath('app/resources', entity.path, fileName)
Expand Down

0 comments on commit 48acda2

Please sign in to comment.