In last post I showed you to open your REST service for everyone to collect data out of it. I n this post I will show you how easy it is also to allow external origin to send data to your service. It is as simple as the last post with just one line.
The scenario for this this requirement is fairly simple, you have a REST service which externalize CRUD operations for some data. e.g. a book collection where you can add new books, update, remove, etc.
If we return to our middleware function, we need to add just one line of code like this:
This will allow us now to add new books to our books collection via our REST service without trouble.
Now the REST service is open for public.