Orders
A Route is basically a backend REST API, where you write code for some DB Operation or anything else. You make request to this route to get some data or execute any other logic on the server.
In order to create a route, fill the following details in the form : -
Name - name of the route.
Path – endpoint URL of the route.
Active – Check / Uncheck if ready / not ready to used.
Route Type: - MS – route type is microservice. SITE – for serving static content. API – for serving data from database. CORE – core route is for system specific operations.
Method: - POST – to post some data. GET – to get some data.
Script – Code goes here.
Click on ‘create’ button. That’s it, you have created a Route.
/getOrders
Below is the code for getOrders API. In this example we are calling a server script xe.Order which has a method called find which will return the list of all orders.
/postOrder
Below is the code for postOrder API. In this example allows user to make an order. In this code we retrieve the form values storing order details and pass it to a server script called xe.Order which has a method called save which will save the order details ot the database.
Last updated