id-gen middleware for generating an id from file path segments.