starting middleware