A simple API using tRPC, NodeJS, TS & TypeORM w/ local MySQL database
\playgroung
-
Retrieves a user with the specified id.
π Request:
await trpc.getUser.query(<user_id>)
π Response:
{ id: <user_id>, name: <user_name> }
-
Retrieves a list of all users.
π Request:
await trpc.getUsers.query()
π Response:
[ { id: <user_id>, name: <user_name> }, { id: <user_id>, name: <user_name> } ]
-
Deletes the user with the specified id.
π Request:
await trpc.deleteUser.query(<user_id>)
π Response:
{ result: true }
-
Updates the name of the user with the specified id.
π Request:
await trpc.updateUser.query(<user_id>, <user_name>)
π Response:
{ id: <user_id>, name: <new_user_name> }
-
Creates a new user with the specified name.
π Request:
await trpc.createUser.query(<user_name>)
π Response:
{ id: <user_id>, name: <user_name> }