Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions docs/cookbook/web/users-groups/creating-user-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Create empty `hello-world` Socket and `hello` endpoint, use `user` from `@syncan
#### Create Socket

```sh
npx s create hello-world --template example
npx s create hello-world
```

#### Edit endpoint file
Expand All @@ -25,19 +25,18 @@ npx s create hello-world --template example
Edit file `syncano/hello-world/src/hello.js` and change its content to:

```js
import crypto
import Syncano from '@syncano/core'

export default (ctx) => {
const {user, response} = Syncano(ctx)
export default async (ctx) => {
const {response, users} = new Syncano(ctx)
const {args} = ctx

user.create({
username: 'tyler.durden@paperstreetsoap.com'
password: crypto.randomBytes(64).toString('hex')
})
.then(userObj => {
response.json({msg: `User with ID ${userObj.id} created!`})
const user = await users.create({
username: args.username,
password: args.password
})

response.json({msg: `User with ID ${user.id} created!`})
}
```

Expand Down