Added cors support
Fix a bug in database connection