Skip to content

An Typscript Websocket Bridge between front-end and backend

Notifications You must be signed in to change notification settings

claytonfbell/noapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

NoAPI

// calling backend function should be this easy
try {
  const myUser: User = await NoAPI.getUserById(123);
} catch(e: NoAPIError) {
  console.log(e.status)
  console.log(e.message)
}

The idea is to build function definitions in TypeScript that are shared by both backend and front-end with the popular socket.io library.

Instead of REST APIs, GraphQL, would pass all data through one websocket layer, but have strongly typed functions to.

This would be like microsofts long time "web services" which bridged C# accross client / server.

Defining your API should be this easy

// need to define methods in one file
interface NoAPIMethods = {
  getUserById: (userId: number) => Promise<User> 
}

Roadmap

  • Get started, try deno with socket.io
  • Setup simple client / server demo with regular socket.io events.
  • Figure out how to make function calls simple from the client
  • Throw consitent http exception object containing messages, status codes.
  • Need to figure out best way to shared definitions with client if they are not from same code repo.
  • Figure out nice way for subscribing to events also

About

An Typscript Websocket Bridge between front-end and backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published