loopbackjs

Loopback - GET model using custom String ID from MongoDB

冷暖自知 提交于 2020-01-03 03:25:11
问题 I'm developing an API with loopback, everything worked fine until I decided to change the ids of my documents in the database. Now I don't want them to be auto generated. Now that I'm setting the Id myself. I get an "Unknown id" 404, whenever I hit this endpoint: GET properties/{id} How can I use custom IDs with loopback and mongodb? Whenever I hit this endpoint: http://localhost:5000/api/properties/20020705171616489678000000 I get this error: { "error": { "name": "Error", "status": 404,

NodeJs - Loopback : How to upload file on google cloud storage

杀马特。学长 韩版系。学妹 提交于 2020-01-03 03:10:10
问题 In loopback framework, we have a module LoopBack Storage Component. It's support for many clouds except Google Cloud Storage. But I have to use Google Cloud. 回答1: It should support Google out of the box because it uses pkgcloud lib which has support for Google Cloud. Try simply adding a config entry to the providers.json file. For more info on how to do that check Loopback storage component documentation and also pkgcloud config format for Google Cloud. I'd just try something like this in the

Return join table attributes in incluce with loopback

六眼飞鱼酱① 提交于 2020-01-02 09:43:39
问题 I've got a data structure fairly similar to the one described on the Loopback HasManyThrough documentation page. For a given Physician (e.g. id 2), I would like to get all their patients with an appointment AND their appointment date. I can do a GET operation like this: GET /physicians/2 with the filter header { "include" : {"relation":"patients"} } And I do get the physician, and the list of patients, but I lose the appointmentDate of the relation. Or, I can do a GET operation on the

Return join table attributes in incluce with loopback

六眼飞鱼酱① 提交于 2020-01-02 09:41:09
问题 I've got a data structure fairly similar to the one described on the Loopback HasManyThrough documentation page. For a given Physician (e.g. id 2), I would like to get all their patients with an appointment AND their appointment date. I can do a GET operation like this: GET /physicians/2 with the filter header { "include" : {"relation":"patients"} } And I do get the physician, and the list of patients, but I lose the appointmentDate of the relation. Or, I can do a GET operation on the

How to include related entities in REST with loopback.io

こ雲淡風輕ζ 提交于 2020-01-02 06:55:12
问题 I'm using Strongloop's loopback tool to create a REST service. I'm wondering how to define what related entities to return when requesting a model. I see in the docs that you can send a request like GET /api/members?filter[include]=posts and that will return the related post models, and I discovered that you can make a request like GET /api/members?filter[include]=posts&filter[include]=comments to get posts and comments, but is there a way to define either in code or the generated json file

Why Principal is not a model, but Role, RoleMapping, ACL are suddenly models?

可紊 提交于 2020-01-02 06:43:49
问题 I'm reading Access control concepts of Loopback (https://docs.strongloop.com/display/public/LB/Authentication%2C+authorization%2C+and+permissions) and I don't understand how happened that Principal is not a model, but Role , RoleMapping , ACL are models with a full set of REST API methods and are listed in model-config.json ? When I tried to include Principal in model-config.json along with Role , RoleMapping and ACL I got error: "ACL": { "dataSource": "db", "public": false }, "RoleMapping":

Why Principal is not a model, but Role, RoleMapping, ACL are suddenly models?

拜拜、爱过 提交于 2020-01-02 06:43:05
问题 I'm reading Access control concepts of Loopback (https://docs.strongloop.com/display/public/LB/Authentication%2C+authorization%2C+and+permissions) and I don't understand how happened that Principal is not a model, but Role , RoleMapping , ACL are models with a full set of REST API methods and are listed in model-config.json ? When I tried to include Principal in model-config.json along with Role , RoleMapping and ACL I got error: "ACL": { "dataSource": "db", "public": false }, "RoleMapping":

How integrate loopback third-party login for android

﹥>﹥吖頭↗ 提交于 2020-01-01 09:18:35
问题 My project includes web and android client. I want to combine Google cross platform sign-in and loopback third-party login. In my scenario, I will never ask username and password. User only uses Google sign-in button for authentication and authorization on both web and android app. Lets assume, it's the first time you logged in with Google sign-in through my web site. In loopback third-party scenario, if you are not existing on db, it creates an account corresponded provider and external id.

How can I replace the default favicon in an slc loopback generated webapp?

给你一囗甜甜゛ 提交于 2020-01-01 05:29:08
问题 I have generated an app using slc loopback command. So the generated express webapp has its strongloop favicon. How can I change the favicon? I am using this in server.js app.use(loopback.favicon(path.resolve(__dirname, '../client/favicon.ico'))); I also tried with html link tag, but still default is loading. What am I doing wrong? 回答1: Set the path to your custom favicon in the server/middleware.json : { "initial:before": { "loopback#favicon": { "params": "path/to/your/favicon.ico" } }, … We

Multiple users roles loopback

一笑奈何 提交于 2019-12-31 07:28:05
问题 I am trying to make an application using Loopback as my back-end. I already used loopback before, but right now I want to do something that I never done before. What I want is simple, I will have 3 types of users, administrator, servicer and default. But, I need to restrict the access controls for each type of user; the administrator can request all my routes, but de default user for example can only request some routes that I will specify. The ACL part I know how to do, but I can't find