https://github.com/globocom/loopback-jsonschema-example
https://github.com/globocom/loopback-jsonschema-example
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/globocom/loopback-jsonschema-example
- Owner: globocom
- Archived: true
- Created: 2014-05-12T13:12:26.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-10-14T16:54:32.000Z (almost 12 years ago)
- Last Synced: 2024-04-08T19:01:16.246Z (over 2 years ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 6
- Watchers: 115
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Loopback JSON Schema Example
Adds JSON Schema support to [LoopBack](https://github.com/strongloop/loopback).
### Configuring a DataSource
Add a `loopbackJsonSchemaDb` entry to the `datasources.json` file with your data source configuration if you want to use any database. If no `loopbackJsonSchemaDb` entry is found, we fallback to using the default memory data source.
```
"loopbackJsonSchemaDb": {
"connector": "loopback-connector-mongodb",
"url": "mongodb://127.0.0.1:27017/your-database",
"debug": true
}
```
## Using
### Installing
```
make setup
make run
```
### Dynamically defining Loopback models from a JSON Schema
```
make post_schema
make create_person
```
```
# Retrieve a created Person object
curl -i -XGET -H "Content-Type: application/json" http://localhost:5000/api/people/{id}
```
## Disclaimer
This is just a simple Loopback app using [loopback-jsonschema](https://github.com/globocom/loopback-jsonschema) module (there're no tests here). Do not use this app in production!
## References
https://github.com/globocom/loopback-jsonschema
http://json-schema.org/