How should I define a list of constants in a TypeScript Express API and also be able to check if a variable's value is in that list?
04:28 14 Jun 2026

I want to define a list of available server functions in my Express app by doing something like the below:

LoginFunction: 0, //maybe login functions are 0-100

GetOrderInfo: 101 //maybe this set of functions is 101-200

CheckInventoryLevels: 201// maybe 201-300

// etc...

Then, I want to be able to check if an incoming request's body has a requested function ID that matches one of those constants I defined above. What data types or classes could I use to achieve something like this? Are there better, more recommended methods to achieve what I'm trying to achieve here?

typescript express