Endpoints on the fly

Create your endpoints while developing your frontend application.

Introduction

The Endpoints On The Fly feature allows developers to develop their backend endpoints while developing their frontend applications they just have to add their Grizzly Query in the header of the request with the keyword query which respects a certain pattern that we will explain in the next section.

Query Keywords

The main parts of a HTTP request generally are the path,method and headers. The Query keyword will be in the headers part of the request and the table below will explain how to fill it up.

Logical keyword Keyword Grizzly Query
And $and {$and:[{firstAttribute:%rankInPath,secondAttribute:%rankInPath}]}
OR $or {$or:[{firstAttribute:%rankInPath,secondAttribute:%rankInPath}]}
Equals {attribute:%rankInPath}
Greater Than $gt {attribute:{$gt:%rankInPath}}
Less Than $lt {attribute:{$gt:%rankInPath}}
Greater Or Equal Than $gte {attribute:{$gte:%rankInPath}}
Less Or Equal Than $lte {attribute:{$lte:%rankInPath}}

Examples

In this part we will explain how to use this feature with the different HTTP methods, so in the next examples we will assume that we have a microservice called Products

GET

If we need to get all the prodcuts we don’t need to pass the query, its default value is {}

 - Path: /prodcuts

To get the product by its name and price for example the Http request will be like this:

- Path: /prodcuts/**<name>**/**<price>**<br>
- Query: {$and:[{name:%1,price:%2}]}

To get the product by its Id the Http request will be like this:

- Path: /prodcuts/**<Id>**<br>
- Query: {Id:%1}

To get the products which prices are higher than other prices:

- Path: /prodcuts/**<price>**<br>
- Query: {price:{$gt:%1}}

POST

If we need to add a product to the database we just need to pass the path and the body of the request , the query will be set to its default value which is {}

 - Path: /prodcuts

DELETE

The delete queries are pretty similar to the GET queries. To delete the products by their Id the request will be in this format {}

- Path: /prodcuts/**<Id>**<br>
- Query: {Id:%1}

To delete the products by their names and prices for example the Http request will be in this format:

- Path: /prodcuts/**<name>**/**<price>**<br>
- Query: {$and:[{name:%1,price:%2}]}

To delete the products which prices are higher than other prices:

- Path: /prodcuts/**<price>**<br>
- Query: {price:{$gt:%1}}

PUT

If we need to update a product we just need to pass the path and the body of the new product

 - Path: /prodcuts