{"_id":"loopback-example-app","_rev":"170-dad778a38b7519f083fbfff1ea069b41","name":"loopback-example-app","dist-tags":{"latest":"3.1.0"},"versions":{"2.0.5":{"name":"loopback-example-app","version":"2.0.5","author":{"name":"Ritchie Martori"},"license":"MIT","_id":"loopback-example-app@2.0.5","maintainers":[{"name":"rfeng","email":"enjoyjava@gmail.com"}],"homepage":"https://github.com/strongloop/loopback-example-app","bugs":{"url":"https://github.com/strongloop/loopback-example-app/issues"},"dist":{"shasum":"768dd85145f00861780bba575321a985383e6906","tarball":"https://registry.npmjs.org/loopback-example-app/-/loopback-example-app-2.0.5.tgz","integrity":"sha512-N35ee5KHsg+/BOnadqkJ3u1nEaIQQwiJrWod33Usk8chQKvXT7k9nKJCAw+rUW8C/CYYlwkDMddG27l2Oua19g==","signatures":[{"sig":"MEUCIQDhppZt9IR2s303Sm10MTd7KU8pw7wjpObwcMrsFPNVUAIgOlU6l4LBYiLXVUkB9dEoU4OB8stZAAwk/5G0mX8uNmQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"app.js","_from":".","_shasum":"768dd85145f00861780bba575321a985383e6906","private":false,"scripts":{"test":"mocha -b -R spec","start":"node app","install":"node build/readme.js"},"_npmUser":{"name":"rfeng","email":"enjoyjava@gmail.com"},"repository":{"url":"https://github.com/strongloop/loopback-example-app.git","type":"git"},"_npmVersion":"1.4.9","description":"LoopBack Example Application","directories":{},"dependencies":{"rc":"~0.4.0","cors":"~2.3.1","async":"~0.9.0","request":"~2.36.0","shuffle":"~0.2.1","loopback":"~1.9.1","weighted":"~0.2.2","text-table":"~0.2.0","loopback-explorer":"~1.1.1","strong-task-emitter":"~0.0.5","loopback-connector-rest":"~1.1.4","loopback-connector-mysql":"~1.4.1","loopback-connector-oracle":"~1.4.1","loopback-connector-mongodb":"~1.4.1","loopback-datasource-juggler":"~1.6.2"},"devDependencies":{"mocha":"~1.20.1","supertest":"~0.13.0"},"optionalDependencies":{"shuffle":"~0.2.1","weighted":"~0.2.2","text-table":"~0.2.0","loopback-connector-mysql":"~1.4.1","loopback-connector-oracle":"~1.4.1","loopback-connector-mongodb":"~1.4.1"}},"3.0.0":{"name":"loopback-example-app","version":"3.0.0","author":{"name":"Miroslav Bajtos","email":"miroslav@strongloop.com"},"license":{"url":"https://github.com/strongloop/loopback-example-app/blob/master/LICENSE","name":"MIT"},"_id":"loopback-example-app@3.0.0","maintainers":[{"name":"rfeng","email":"enjoyjava@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"strongloop","email":"callback@strongloop.com"}],"homepage":"https://github.com/strongloop/loopback-example-app","bugs":{"url":"https://github.com/strongloop/loopback-example-app/issues"},"dist":{"shasum":"5f6b5192675d406ab8b899f5e2891c6fe3a23531","tarball":"https://registry.npmjs.org/loopback-example-app/-/loopback-example-app-3.0.0.tgz","integrity":"sha512-yJtsXDS6yDDLxj2FXDicxL5MIiCWwf9x6Wl74QGttW9BTTM8g5M9kHCSyQJi9MXVEe1OBlzoONfnQL8nNPOevA==","signatures":[{"sig":"MEUCIQCu4TyUfrkqIUxf2SZD20kvEFCxGvCx8qmwjOUbc9+6pgIgHQWyPT7WnX30IVDsXPWzBHX1OMsZBq8F8y1KR54ZWuw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"server/server.js","_from":".","_shasum":"5f6b5192675d406ab8b899f5e2891c6fe3a23531","scripts":{"test":"mocha -R spec server/test","pretest":"jshint ."},"_npmUser":{"name":"rfeng","email":"enjoyjava@gmail.com"},"repository":{"url":"https://github.com/strongloop/loopback-example-app.git","type":"git"},"_npmVersion":"1.4.9","description":"LoopBack Example Application","directories":{},"dependencies":{"async":"~0.9.0","request":"^2.37.0","shuffle":"~0.2.1","loopback":"^2.0.0","weighted":"~0.2.2","text-table":"~0.2.0","compression":"^1.0.3","errorhandler":"^1.1.1","loopback-boot":"^2.0.0","serve-favicon":"^2.0.1","loopback-explorer":"^1.1.0","function-rate-limit":"~0.0.1","loopback-connector-rest":"^1.1.4","loopback-connector-mysql":"^1.2.1","loopback-connector-oracle":"^1.2.1","loopback-connector-mongodb":"^1.2.5","loopback-datasource-juggler":"^2.0.0"},"devDependencies":{"mocha":"^1.20.1","supertest":"^0.13.0"},"optionalDependencies":{"loopback-explorer":"^1.1.0","loopback-connector-mysql":"^1.2.1","loopback-connector-oracle":"^1.2.1","loopback-connector-mongodb":"^1.2.5"}},"3.1.0":{"name":"loopback-example-app","version":"3.1.0","author":{"name":"Miroslav Bajtos","email":"miroslav@strongloop.com"},"license":{"url":"https://github.com/strongloop/loopback-example-app/blob/master/LICENSE","name":"MIT"},"_id":"loopback-example-app@3.1.0","maintainers":[{"name":"rfeng","email":"enjoyjava@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"strongloop","email":"callback@strongloop.com"}],"homepage":"https://github.com/strongloop/loopback-example-app","bugs":{"url":"https://github.com/strongloop/loopback-example-app/issues"},"dist":{"shasum":"0482f669bab920900457626e681b7164e76fcc17","tarball":"https://registry.npmjs.org/loopback-example-app/-/loopback-example-app-3.1.0.tgz","integrity":"sha512-ITfbdn4mhlNRq1jKLTO5+EBn4Qqr+6dzUKA2BKuvZa1vXG7kCLjNvH69yd31srsArxq2Z/djlAAJxuJulI/vIg==","signatures":[{"sig":"MEUCIQDYJee7wnFTupWHOfApzxVmITzNJylZdMzVl51jd1tJjQIgPvXsgG7hp39t1Y36kUuAU8MkAWSDRNCoB1ARi1Cb1eE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"server/server.js","_from":".","_shasum":"0482f669bab920900457626e681b7164e76fcc17","gitHead":"5af5d6d8654f0b841b44393792070dfa9a3183c7","scripts":{"test":"mocha -R spec server/test","pretest":"jshint ."},"_npmUser":{"name":"rfeng","email":"enjoyjava@gmail.com"},"repository":{"url":"https://github.com/strongloop/loopback-example-app.git","type":"git"},"_npmVersion":"1.4.28","description":"LoopBack Example Application","directories":{},"dependencies":{"async":"~0.9.0","request":"^2.37.0","shuffle":"~0.2.1","loopback":"^2.0.0","weighted":"~0.2.2","text-table":"~0.2.0","compression":"^1.0.3","errorhandler":"^1.1.1","loopback-boot":"^2.0.0","serve-favicon":"^2.0.1","loopback-explorer":"^1.1.0","function-rate-limit":"~0.0.1","loopback-connector-rest":"^1.1.4","loopback-connector-mysql":"^1.2.1","loopback-connector-oracle":"^1.2.1","loopback-connector-mongodb":"^1.2.5","loopback-datasource-juggler":"^2.0.0"},"devDependencies":{"mocha":"^1.20.1","jshint":"^2.7.0","supertest":"^0.13.0"},"optionalDependencies":{"loopback-explorer":"^1.1.0","loopback-connector-mysql":"^1.2.1","loopback-connector-oracle":"^1.2.1","loopback-connector-mongodb":"^1.2.5"}}},"time":{"created":"2014-07-24T19:09:39.921Z","modified":"2024-07-09T12:43:19.083Z","2.0.5":"2014-07-24T19:09:39.921Z","3.0.0":"2014-07-24T19:13:39.734Z","3.1.0":"2015-08-04T16:10:58.631Z"},"bugs":{"url":"https://github.com/strongloop/loopback-example-app/issues"},"author":{"name":"Miroslav Bajtos","email":"miroslav@strongloop.com"},"license":{"url":"https://github.com/strongloop/loopback-example-app/blob/master/LICENSE","name":"MIT"},"homepage":"https://github.com/strongloop/loopback-example-app","repository":{"url":"https://github.com/strongloop/loopback-example-app.git","type":"git"},"description":"LoopBack Example Application","maintainers":[{"email":"enjoyjava@gmail.com","name":"rfeng"},{"email":"r.m.graham@gmail.com","name":"rmg"},{"email":"dianahmlau@gmail.com","name":"dhmlau"},{"email":"jgorzinski@gmail.com","name":"theprez"},{"email":"skawful@gmail.com","name":"ritch"}],"readme":"## Prerequisites\n\nYou must have already installed [Node.js](https://nodejs.org/).\n\nInstall StrongLoop:\n```\n$ npm install -g strongloop\n```\n\nIf you run into any issues, see [Installing StrongLoop](http://docs.strongloop.com/display/LB/Installing+StrongLoop)\nfor more information.\n\n## i-Car Rentals Corp\n\ni-Car is an (imaginary) car rental dealer with locations in major cities around\nthe world. They need to replace their existing desktop reservation system with\na new mobile app.\n\nThis application was created using LoopBack tools. \nSee [Building from scratch](#building-from-scratch) below for more details.\n\n### Run the application\n\nStart the application back-end by running the following command:\n\n```\n$ node . \n```\n\nNow open your browser and point it to\n[http://127.0.0.1:3000](http://127.0.0.1:3000) to access the application UI.\n\n### End user experience\n\nThe app enables customers to find the closest available cars using the i-Car app\non a smartphone. The app shows a map of nearby rental locations and lists\navailable cars in the area shown on the map. In addition, the customer can\nfilter the list of cars by make, model, class, year and color. The customer can\nthen select the desired car and reserve it via the app. If not logged in the app\nprompts the customer to login or register. The app indicates if the desired car\nis available and if so, confirms the reservation.\n\n### Features\n\n - Authenticates and verifies customers' identities.\n - Securely exposes inventory data to mobile applications.\n - Allow customers to find cars available **within a specific area**.\n - Allow customers to reserve cars for rental.\n\n## REST APIs\n\n - `/cars` exposes a queryable (filter, sort) collection of available cars\n    over HTTP / JSON\n - `/cars/nearby?&lat=...&long=... or ?zip=...` returns a filtered set of\n    available cars nearby the requesting user\n - `/cars/nearby?id=24&zip=94555` returns nearby cars of id 24.\n - `/cars/:id` returns a specific car from the inventory, with specific\n    pricing and images\n - `/users/login` allows a customer to login\n - `/users/logout` allows a customer to logout\n\n## Configuring the data source\n\nBy default, the sample application uses the memory connector and listens on\nthe port 3000 on all network interfaces.\n\nYou can configure other data sources by adding a new key to `DATASTORES`\nobject in `rest/datasources.local.js`:\n\n```js\nvar DATASTORES = {\n  custom: {\n    connector: 'my-custom-connector',\n    // configuration for the custom connector\n  },\n  memory: {\n  },\n  // etc.\n};\n```\n\nThe sample can be configured using the following environment variables:\n\n- `DB`: The db type, use `memory`, `mongodb` or `oracle`\n- `IP`: The http server listener ip address or hostname, default to `0.0.0.0`\n   (any address)\n- `PORT`: The http server listener port number, default to `3000`\n\nFor example,\n\n - To run the application at port 3001 with MongoDB:\n\n   ```\n   $ DB=mongodb PORT=3001 node .\n   ```\n\n - To run the application at port 3002 with Oracle:\n\n  ```\n   $ DB=oracle PORT=3002 node .\n  ```\n\n\n## Schema and specifications\n\n### Customer Database\n\nThe app will get all customer information from the SalesForce API.\n\n### Inventory Database\n\nAll car inventory is already available in an **existing** Oracle X3-8 Exadata\ndatabase.\n\nThe Inventory DB schema looks like this:\n\n#### **Customers**\n - id string\n - name string\n - username string\n - email string\n - password string\n - realm string\n - emailverified boolean\n - verificationtoken string\n - credentials string[]\n - challenges string[]\n - status string\n - created date\n - lastupdated date\n \n#### **Reservations**\n - id string\n - product_id string\n - location_id string\n - customer_id string\n - qty number\n - status string\n - reserve_date date\n - pickup_date date\n - return_date date\n\n#### **Inventory_Levels**\n - id string\n - product_id string\n - location_id string\n - available number\n - total number\n \n#### **Car**\n- id string\n- vin string\n- year number\n- make string\n- model string\n- image string\n- carClass string\n- color string\n \n#### **Location**\n - id string\n - street string\n - city string\n - zipcode string\n - name string\n - geo GeoPoint\n\n#### **Inventory_View**\n\n**View** to return qty of available products for the given city.\n\n - product (product name)\n - location (location name)\n - available (qty available)\n\n### Geo Lookup\n\nGoogle's location API is used to return the users city from a given zip or lat/long.\n\n## Project files\n\nThe project is composed from multiple components.\n\n - `models/` contains definition of models and implementation of custom model\n   methods.\n\n - `rest/` contains the REST API server, it exposes the shared models\n   via REST API.\n\n - `website/` contains a simple single-page-application that is served\n  when users open the project in the browser.\n\n - `server/` is the main HTTP server that brings together all other components.\n\n - `sample-data/` contains a set of sample models that are used to initialize\n  the database with some data.\n\n - `test/` provides few basic unit-tests to verify that the server provides\n  the expected API.\n\nRefer to\n[Creating an application](http://docs.strongloop.com/display/LB/Creating+an+application)\nfor more information.\n\n## Building from scratch\n\nYou can create most of the sample application using LoopBack's Yeoman generators. \nSee the `slc loopback` [command-line reference](http://docs.strongloop.com/pages/viewpage.action?pageId=3836281)\nfor more information.\n\nInstall StrongLoop with `npm install -g strongloop` to install the LoopBack generators.\n\nOnce you have the generators installed, run the following command to recreate\nthe sample app from scratch:\n\n```\n$ slc loopback:example example-app -l\n```\n\nThis will call other generators like `slc loopback` and `slc loopback:model`\nto scaffold the application. You can learn more about these generators in the \n[slc command-line reference](http://docs.strongloop.com/pages/viewpage.action?pageId=3836281).\n\nWhen run with the `-l` option, the example generator\nprints a detailed list of steps that are executed to walk you trough the\nscaffolding process. You can re-run the steps manually yourself to get a better\nunderstanding of how the loopback generators work.\n\nThis is how the output looks like:\n\n```\nCreate initial project scaffolding\n  $ slc loopback:app loopback-example\n    [?] Enter a directory name where to create the project: .\n    [?] What's the name of your application? loopback-example\n\n\nI'm all done. Just run npm install to install the required dependencies.\n\n\nAdd datasource geo\n  $ slc loopback:datasource geo\n    [?] Select the connector for geo: rest\n  Set datasource options: operations\nAdd model Car\n  $ slc loopback:model Car\n    [?] Select the data-source to attach Car to: db\n    [?] Expose Car via the REST API?\n    [?] Property name:\n  $ slc loopback:property\n    [?] Select the model: Car\n    [?] Enter the property name: id\n    [?] Property type: string\n    [?] Required? false\n  Set property options: id\n  (more properties follow in the output)\n  Add relation Car hasMany Reservation\n  Set model options: mysql mongodb oracle\nAdd model Customer\n(and so on)\n```\n\nThe first step is to prepare the project infrastructure by\nrunning `slc loopback:app`, which is an alias for `slc loopback`.\n\nThen there is a `geo` datasource added by running `slc loopback:datasource geo`.\nWhen prompted for the connector to use, the `rest` is selected. After the\ndatasource was created, the REST operations are added to the generated\nfile `datasources.json` manually.\n\nThe next step is to create all application models. The generator\n`slc loopback:model` is called to define a new model, `slc loopback:property` to\nadd a property definition to the new model. Some property options like\n`\"id\": true` are not supported by the generator, they are added manually.\n\nAlso model relations and per-datasource model configurations are not supported\nby the generator yet, as can be seen from these two lines:\n\n```\n  Add relation Car hasMany Reservation\n  Set model options: mysql mongodb oracle\n```\n\nOpen the file `models/car.json` too see what has been added by the generator.\n\nWhen all models are defined, the example generator performs steps that you\nwould do manually when working on a new application: add more dependencies to\npackage.json, extend the models with custom behaviour, implement unit-tests,\netc.\n","readmeFilename":"README.md"}