How can I get my toddler to stay asleep in her room at night?

Hey, so I need help! My two-year-old won’t stay asleep in her room at night! I’ve tried everything! My poor husband has now been sleeping on the couch. My husband does try his best to help, but at night she hates him and doesn’t want anything to do with him. Plus, I had surgery on my foot about a month ago. I’m at a loss, and I don’t know what to do.