strongloop

Strongloop iOS LBUser Extension Error 422 in Post

本秂侑毒 提交于 2019-12-13 00:44:26
问题 I'm trying to create and save a user extension of LBUser to the server with this code: LBRESTAdapter *adapter = ((AppDelegate *)[[UIApplication sharedApplication] delegate]).adapter; if (adapter) { TeacherRepository *repo = (TeacherRepository *)[adapter repositoryWithClass:[TeacherRepository class]]; if (repo) { Teacher *st = (Teacher *)[repo createUserWithEmail:@"test@test.com" password:@"test"]; st.bigarea = @"Mathematics"; NSLog(@"Email: %@", st.email); NSLog(@"Password: %@", st.password);

loopback: logging queries executed by datasource

非 Y 不嫁゛ 提交于 2019-12-12 10:18:24
问题 Is there a remote method in Loopback data-juggler or any other loopback component which will let me log the query that is executed by the datasource. Eg: If i'm using MySQL connector, then when MODEL_NAME.findById() is called, i should be able to get SELECT * from DATABASE_NAME.MODEL_TABLE where id = WHATEVER_ID Similarly for MongoDB, it should return equivalent mongo query It'd be great if i am able to log query.explain() of mongo here itself I've tried running my app as DEBUG=loopback

How to use TypeScript with Loopback

≯℡__Kan透↙ 提交于 2019-12-12 08:33:46
问题 I'm using Loopback from Strongloop as a REST framework and ORM. I want to use TypeScript for my business logic. However, Loopback requires JavaScript with a specific shape to support their framework. For example: module.exports = function(Person){ Person.greet = function(msg, cb) { cb(null, 'Greetings... ' + msg); } Person.remoteMethod( 'greet', { accepts: {arg: 'msg', type: 'string'}, returns: {arg: 'greeting', type: 'string'} } ); }; What is the TypeScript code that will generate the above

Creating Permanent AccessToken in loopback

蓝咒 提交于 2019-12-12 07:14:24
问题 How to create a permanent access token for a StrongLoop API. Now for every user login it creates an access token. And unnecessary entry in my db I can increase the validity of access token(ttl) as mentioned here. But still it will generate for new login. 回答1: You are mixing up 2 different things. The AccessToken entry creation and the ttl value for the AccessToken. When a user logs in a new AccessToken is created. If the user logs out the AccessToken is removed. If the user logs in 2 times,

strongloop loopback: how to add remote method to loopback-component-storage Container

妖精的绣舞 提交于 2019-12-12 06:10:21
问题 I'm trying to add a new REST API method to the loopback-component-storage for downloading all photos from a Container. (see Strongloop loopback-storage-service: how to use StorageService.downloadStream() to download a ZIP of all photos in container?) The following code seems to work, but I'd like to know how to load the storage-handler, handler , and filesystem provider, factory , correctly within the strongloop framework. Also, I shouldn't have to copy the data in datasources.json Any

Strongloop loopback-storage-service: how to use StorageService.downloadStream() to download a ZIP of all photos in container?

别等时光非礼了梦想. 提交于 2019-12-12 04:57:04
问题 I'm using loopback-component-storage with the filesystem provider to upload photos. It works great. But now I have a request to 'export/download' photos to a zip archive. I've put together some code to add another method, downloadContainer() to Container from the file-storage example. It uses the Archiver module, everything seems to work fine, but the browser crashes after I call zip.finalize() I'm expecting to get a save file dialog box instead... Here is my code so far: Container

Strongloop iOS User Creation Error

不羁的心 提交于 2019-12-12 04:47:27
问题 I'm trying to create and save a test user in server with this code: LBRESTAdapter *adapter = ((AppDelegate *)[[UIApplication sharedApplication] delegate]).adapter; if (adapter) { TeacherRepository *repo = (TeacherRepository *)[adapter repositoryWithClass:[TeacherRepository class]]; if (repo) { Teacher *st = (Teacher *)[repo createUserWithEmail:@"test@test.com" password:@"test"]; if (st) { [st saveWithSuccess:^{ NSLog(@"Saved in server!"); } failure:^(NSError *error) { NSLog(@"Error: %@",

How to specify Strongloop model schema?

怎甘沉沦 提交于 2019-12-12 04:18:33
问题 I try override find api of strongloop rest endpoint. I want to return an array of objects. But how do I specify the schema for the object? As you can see from the picture above, the model schema is empty. Below is the code of my company model remoteMethod: Company.remoteMethod( 'find', { accepts: {arg: 'msg', type: 'string'}, returns: {type: 'array', root: true}, http: {path: '/', verb:'get'} } ) 回答1: If I understand you right, your'e trying to show at this section the returned model as

Strongloop discovery model still empty

有些话、适合烂在心里 提交于 2019-12-12 03:22:31
问题 I am using Strongloop to create a RESTful API in Node.js. I configured the database connection and the connection test is ok. Now what i am trying is importing my models from my database to Strongloop. I use the "Discover models" option but when i click on it a window appears but the tables remain blank. However I am sure that my database is contening a lot of tables. (I am using a ClearDB database with an Heroku account) Can someone please help me? Thank you 回答1: I found I had to define the

Strongloop How to config mysql timezone?

橙三吉。 提交于 2019-12-12 02:23:18
问题 I'm a greenhand for strongloop. My datasources.json config is as follows: "platformDB": { "host": "localhost", "port": 3306, "database": "way", "username": "root", "password": "root", "name": "platformDB", "connector": "mysql" }, and UserAccount is my one model as follows: "name": "UserAccount", "plural": "user", "base": "PersistedModel", "idInjection": true, "properties": { "id": { "type": "number", "required": false }, "accountName": { "type": "string", "required": false }, "roleName": {