strongloop / loopback-sandbox Goto Github PK
View Code? Open in Web Editor NEWA repository for reproducing LoopBack community issues.
A repository for reproducing LoopBack community issues.
I am getting error: Error: Cannot call Test.create(). The create method has not been setup The PersistedModel has not been correctly attached to a datasource.
Here is my datasource.json:
{
"db": {
"name": "db",
"connector": "memory"
},
"mongoDS": {
"host": "localhost",
"port": 27017,
"name": "mongoDS",
"database": "akhiltest",
"connector": "mongodb"
}
}
model-config.json:
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../common/mixins",
"./mixins"
]
},
"User": {
"dataSource": "db"
},
"AccessToken": {
"dataSource": "db",
"public": false
},
"ACL": {
"dataSource": "db",
"public": false
},
"RoleMapping": {
"dataSource": "db",
"public": false,
"options": {
"strictObjectIDCoercion": true
}
},
"Role": {
"dataSource": "db",
"public": false
},
"Test": {
"dataSource": "mongoDS",
"public": true
}
}
test.js
'use strict';
module.exports = function(Test) {
Test.create({
"first_name":"akhil"
},function(data){
console.log(data);
})
};
test.json
{
"name": "Test",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"first_name": {
"type": "string"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
Your help will be highly appreciated
here in strongloop scope docs
the default scope field didn't function as supposed
Hi,
I hit by an issue for model rest api. For multi-tenant support, I dynamically created new DS, and models for every user. and plural is also different for every user. For example, user1 model rest url is like '.../api/UsersAAAAs', user2 will be '.../api/UsersBBBBBs'. One connector module is put to loopbackProj/node-modules.
When user1 and user2 both post a request to create their DS and Models (attach to their DS and APP, model only has different name and plural), user1's model rest api will not be effect, user2 model rest api can work.
For example, access user
Could you please give me any comments? Thanks very much!
Add a branch (or make master) use Loopback 3.
Now that loopback 3 is released, would be good to have a sandbox/demo project that uses the latest and greatest.
as per @richardpringle 's suggestion
update to use strong-error-handler, like how it would be scaffolded from workspace
related to strongloop/loopback#1650
Add branch with example models and boot script for specific configurations:
I am able to get current user in serverjs but when getCurrentContext used to get current user in app it
reuslts into null value .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.