you can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture. This is done by defining your Apex class with the @RestResource annotation to expose it as a REST resource. You can then use global classes and a WebService callback method
We can expose an Apex class as a REST web service by writing @RestResource on the top of the class and also giving the URL address in the parameters which will be used with the complete URL to hit on the REST class.
@RestResource(urlMapping=’/getAccount/*’)