How to Create a Custom API Endpoint in Strapi

Hi, there is a way to format the custom API response to the format from the content type endpoints that wish to include the data and meta objects for pagination?

Example:

data [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
0 Object { id: 1, attributes: {…} }
1 Object { id: 2, attributes: {…} }
2 Object { id: 3, attributes: {…} }
3 Object { id: 4, attributes: {…} }
4 Object { id: 5, attributes: {…} }
5 Object { id: 6, attributes: {…} }
6 Object { id: 7, attributes: {…} }
7 Object { id: 8, attributes: {…} }
8 Object { id: 9, attributes: {…} }
9 Object { id: 10, attributes: {…} }
10 Object { id: 11, attributes: {…} }
11 Object { id: 12, attributes: {…} }
12 Object { id: 13, attributes: {…} }
13 Object { id: 14, attributes: {…} }
14 Object { id: 15, attributes: {…} }
15 Object { id: 16, attributes: {…} }
16 Object { id: 17, attributes: {…} }
17 Object { id: 54, attributes: {…} }
18 Object { id: 55, attributes: {…} }
meta Object { pagination: {…} }
pagination Object { page: 1, pageSize: 25, pageCount: 1, … }

Preferred to the extent the controller core from strapi factory or calling any object of function in strap not by plugins.

Thanks in advance