Converted into expressjs middleware