Skip to content

lewis-wow/ptsq-express-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ptsq simple Express example

ptsq docs

https://ptsq-docs.vercel.app/

Commands to run the example

Start the ptsq server

npm run start:server

Start the proprietary client

npm run start:client

Generate the schema from the server for remote cliet

npm run schema:generate

Start the remote client

npm run start:remote-client

What is interesting

Take a good look at client.ts and remote-client.ts and compare the codes. They are almost identical.

Try to change the server.ts resolver like this.

const baseRouter = router({
  greetings: resolver
    .args(
      z.object({
        name: z.number(),
      })
    )
    .query({
      output: z.string(),
      resolve: ({ input }) => {
        return `Hello, ${input.name}`;
      },
    }),
});

And take a good look at client.ts, Typescript should display a type error.

You can also then regenerate the schema for remote-client.ts to see the same error.

For see changes in runtime, you have to restart the server.ts, this example does not use something like nodemon.

About

ptsq simple Express example

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published