Cryptocurrency API Gateway using Typescript+Workers
If you followed part one, I have an environment setup where I can write Typescript with tests and deploy to the Cloudflare Edge with npm run upload. For this post, I want to take one of the Worker Recipes further.
I'm going to build a mini HTTP request routing and handling framework, then use it to build a gateway to multiple cryptocurrency API providers. My point here is that in a single file, with no dependencies, you can quickly build pretty sophisticated logic and deploy fast and easily to the Edge. Furthermore, using modern Typescript with async/await and the rich type structure, you also write clean, async code.
OK, here we go...
My API will look like this:
| Verb | Path | Description |
|---|---|---|
| GET | /api/ping |
Check the Worker is up |
| GET | /api/all/spot/:symbol |
Aggregate the responses from all our configured gateways |
| GET | /api/race/spot/:symbol |
Return the response of the provider who responds fastest |
| GET | /api/direct/:exchange/spot/:symbol |
Pass through the request to the gateway. E.g. gdax or bitfinex |
The Framework
OK, this is Typescript, I get interfaces and I'm going to use them. Here's my ultra-mini-http-routing framework definition:
export interface IRouter {
route(req: RequestContextBase): IRouteHandler;
}
/**
* A route
*/
export interface IRoute Continue reading
He promised on behalf of the “mobile operator fraternity” that they will never throttle speeds.

In addition to storing video data for pre-game preparation and game-time decision making, Datrium DVX will also support the scouting database used for serving statistics on college and NFL players in real-time on draft day.