Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loopback Rest API without connecting to database

I am planning to use some service from other SDK, but I don't know how to create a Rest API without having to connect to datasource. Currently, I have to create a remote hook inside a loopback database model which are not even relevant to each other. For example, I would like to call a Text Message Service API from Twilio, but I have to create the remote hook in Class Model since it's connected the database. Can I create a API without creating a model and connected to the datasource.

like image 750
cjskywalker Avatar asked Feb 24 '26 20:02

cjskywalker


1 Answers

For using 3rd party REST APIs you can use a loopback-connector-rest datasource. The documentation for the connector can be found here.

Otherwise, you can create a model without connecting it to a datasource by setting it up in your model-config.json as follows:

"ModelName": {
  "datasource": null
}
like image 132
richardpringle Avatar answered Feb 27 '26 01:02

richardpringle