Skip to content

How would I create a “pre-“ middleware? #2552

Closed Answered by dalanmiller
dalanmiller asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, I solved my own problem here thanks to your tips above 🎉 - thank you!

What wasn't clear to me is that when I want to access both Environment Variables and session variables I need to specify that in the Hono instantiation:

type Variables = {
  stripe: Stripe;
  livemode: boolean;
};

type Bindings = {
  STRIPE_RK: string;
  STRIPE_TK: string;
};

const app = new Hono<{ Bindings: Bindings; Variables: Variables }>();

I don't think this is entirely evident in either the var docs or the env docs and I may be wrong here, but I don't think the Typescript aspects this are obvious even if you are a Typescript veteran.

For instance the following code example is incomplete, isn't it? You'd s…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@dalanmiller
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@yusukebe
Comment options

Answer selected by dalanmiller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants