title: Creating Node.js enum in code to match list of values in database
body: <p>I have a list of valid values that I am storing in a data store.  This list is about 20 items long now and will likely grow to around 100, maybe more.</p>
  
  <p>I feel there are a variety of reasons it makes sense to store this in a data store rather than just storing in code.  I want to be able to maintain the  list and its metadata and make it accessible to other services, so it seems like a micro-service data store.</p>
  
  <p>But in code, we want to make sure only values from the list are passed, and they can typically be hardcoded.  So we would like to create an enum that can be used in code to ensure that valid values are passed.</p>
  
  <p>I have created a simple node.js that can generate a JS file with the enum right from the data store.  This could be regenerated anytime the file changes or maybe on a schedule.  But sharing the enum file with any node.js applications that use it would not be trivial.</p>
  
  <p>Has anyone done anything like this?  Any reason why this would be a bad approach?  Any feedback is welcome.</p>