A switch port can be configured to be a Layer 3 routed port and behave like a regular router interface. Specifically, a routed port:

Configure routed ports by putting the interface into Layer 3 mode with the no switchport interface configuration command. Then assign an IP address to the port. That's it!