{"id":19574462,"url":"https://github.com/hybridlogics/loopback-angular-setup","last_synced_at":"2025-02-26T11:18:30.292Z","repository":{"id":201885632,"uuid":"76643167","full_name":"hybridlogics/loopback-angular-setup","owner":"hybridlogics","description":"A simple Loopback setup to wire up with AngularJs","archived":false,"fork":false,"pushed_at":"2016-12-20T10:04:11.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-09T03:58:59.796Z","etag":null,"topics":["angularjs","loopback","loopback-application","loopback-setup","strongloop","tutorial"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hybridlogics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-16T10:02:56.000Z","updated_at":"2016-12-16T10:06:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"11f206b1-40b7-4536-9340-e14de2f19bb6","html_url":"https://github.com/hybridlogics/loopback-angular-setup","commit_stats":null,"previous_names":["hybridlogics/loopback-angular-setup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hybridlogics%2Floopback-angular-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hybridlogics%2Floopback-angular-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hybridlogics%2Floopback-angular-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hybridlogics%2Floopback-angular-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hybridlogics","download_url":"https://codeload.github.com/hybridlogics/loopback-angular-setup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240840106,"owners_count":19866168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angularjs","loopback","loopback-application","loopback-setup","strongloop","tutorial"],"created_at":"2024-11-11T06:41:54.103Z","updated_at":"2025-02-26T11:18:30.241Z","avatar_url":"https://github.com/hybridlogics.png","language":"JavaScript","readme":"# Wiring Up Loopback With AngularJs - Part 1\n\nOpen terminal / cmd(command-line)\n\n```\n$ git clone \n$ cd loopback-getting-started\n$ npm install\n$ node . # then browse to localhost:3000\n```\n\nA simple person list using AngularJS on the client-side and LoopBack on the\nserver-side.\n\n## Prerequisites\n\n### Tutorials\n\n- [Getting started with LoopBack]\n\n\n## Procedure\n\n### Create the application\n\n##### Application information\n\n- Name: `getting-started-loopback`\n- Directory to contain the project: `getting-started-loopback`\n\n```\n$ slc loopback:model person\n... # follow the prompts\n```\n\n### Run the application\n\nFrom the project root, enter `node .` and browse to [`localhost:3000`](http://localhost:3000)\nto view the application.\n\n\nThis tutorial will walk through the initial steps to create a basic LoopBack application. The application you’ll create is in the loopback-getting-started GitHub repository. To make it easy for you to pick up the tutorial at any point, there are tags for each step of the tutorial.\nYou can run through the steps to create the app and get a sense for some of the things LoopBack can do:\n1.\tInstalling StrongLoop\n2.\tCreating Simple App using StrongLoop\n\n\n#### 1.Installing StrongLoop\n\n   StrongLoop’s Node API platform consists of:\n•\tLoopBack, an open-source Node application framework based on Express.\n•\tStrongLoop Process Manager and related devops tools for Node applications.\n### What you’re going to do\n   Follow the instructions for your operating system:\n### Installing on MacOS\n##### Install compiler tools\nIf you want features such as application profiling or monitoring, you may need to install compiler tools before you start.  \nInstall:\n-\t[Apple Xcode](https://angularjs.org/)\n-\tDepending on your version of MacOS and Xcode, you may need to also install the command-line tools.  To install them in Xcode:\n1.\tClick Xcode \u003e Preferences.\n2.\tChoose Downloads.\n3.\tClick the install button next to “Command-line Tools”.\nMost versions of OSX come with Python by default.  If for some reason you don’t have it, download and install Python.\nXcode license issues\n\nIf you see errors such as:\n\n~~~\nEnter the following command to validate your Xcode license, then reinstall \n~~~\nThen you recently upgraded or installed Xcode and haven’t agreed to the license yet. \n\n### StrongLoop:\n \n- Set directory permissions\n- Set directory privileges\n- To install Node and StrongLoop , you need permissions to write to directories:\n~~~\n\t/usr/local/bin \n\t/usr/local/lib/node_modules \n~~~\nIf you see errors such as:\n \n  \n~~~\nEither change the rights for the specified directories, or run the command using sudo.\n~~~\nThen you don’t have the required rights to create files or directories.\n\n#  Install Node.js\nIf you haven’t already installed Node, download the native installer from [NODE](https://nodejs.org/) and run it.\n\n### Install StrongLoop\nFollow these steps:\n-\tOpen a Terminal window.\n-\tEnter this command:\n~~~\n$ sudo npm install -g strongloop\n~~~\nIf you didn’t set your file and directory privileges as instructed above, use this command (not recommended):\n\n# Installing on Windows\n### Installing Compiler tools\n- Configuring Python directory\n- Npm uses node-gyp to compile native modules, and node-gyp requires Python.  If you installed Python in a non-standard directory, run this command to configure your setup:\n~~~\n$ npm config set python /path/to/python\n~~~\nwhere /path/to/python  is the directory where Python is installed.\n\n### Install the following:\n-\tPython (v2.7.3 recommended, v3.x.x is not supported). \n-\tMicrosoft Visual Studio C++ 2013 (or later) for Windows Desktop.  The Express version works well.\n#### For Windows 7:\n-\tFor 64-bit builds of Node and native modules you will also need the Windows 7 64-bit SDK.  If the install fails, try uninstalling any C++ 2010 x64\u0026x86 Redistributable that you have installed first.\n-\tIf you get errors that the 64-bit compilers are not installed you may also need the compiler update for the Windows SDK 7.1.\n- [Python]\n- npm uses Python 2.7 (not 3.x, and not 2.6.x or earlier) to install packages with compiled add-ons (such as strong-agent, or websocket support).\n- Download Python 2.7.x from https://www.python.org/downloads/windows/\n- \tDownload latest stable 2.7.x Windows MSI Installer, either x86 or x86-64, as appropriate\n- Run installer, and make sure to add to Path:\n- Accept the default, Install for all users.\n- Accept default “c:\\Python27” for Python files.\n- Enable the option Add python.exe to Path.\n~~~\nInstall Git\n~~~\nThe Node package manager tool, npm, uses Git to download packages from Github. \nTo install Git:\n-\tGo to http://git-scm.com/download,\n-\tDownload the version for Windows.  Currently this is version 1.9.4.\n-\tRun installer:\n--\tAccept default install location\n--\tAccept or modify Components\n--\tAccept start menu folder\n--\tModify `Adjusting your PATH environment` to “Use Git from Windows Command Prompt”\n--\tAccept default “Configuring the line ending conversions”\nConfiguration\n###### By default, Git on Windows does not support paths longer than 260 characters; to avoid errors you must enable long paths with the following command:\n`C:\\\u003e git config --system core.longpaths true`\nInstall Node.js\n-\tGo to http://nodejs.org/download/.\n-\tDownload the latest `Windows Installer (.msi)`, 32 or 64-bit, as appropriate.\n-\tRun the installer.\n- Install latest version of npm\n--The version of npm installed as part of the Node installation has known issues on Windows. To avoid these problems, install the latest version of npm:\n`C:\\\u003e npm install -g npm`\n\n### Install StrongLoop\n\n-\tAfter installing the prerequisites as instructed above, restart your machine to ensure all configuration changes have taken effect.\n-\tOpen a Windows Command Prompt. \n-\tInstall StrongLoop:\n-  `C:\\\u003e npm install -g strongloop`\n\n##\tCreating Simple App Using  StrongLoop\n#### Create new application\nTo create a new application, run the LoopBack application generator:\nIf using StrongLoop tools:\n ```\n slc loopback\n ```\n\nThe LoopBack generator will greet you with some friendly ASCII art and prompt you for the name of the application.\nEnter `getting-started-loopback`. Then the generator will prompt you for the name of the directory to contain the project; press Enter to accept the default (the same as the application name):\n~~~\n _-----_\n    |       |    .--------------------------.\n    |--(o)--|    |  Let's create a LoopBack |\n   `---------´   |       application!       |\n    ( _´U`_ )    '--------------------------'\n    /___A___\\\n     |  ~  |\n   __'.___.'__\n ´   `  |° ´ Y `\n[?] What's the name of your application? loopback-getting-started\n[?] Enter name of the directory to contain the project: getting-started-loopback\n~~~\n \nThen the tool will ask you what kind of application to create:\n ~~~\n? What kind of application do you have in mind? (Use arrow keys)\n❯ api-server (A LoopBack API server with local User auth)\n  empty-server (An empty LoopBack API, without any configured models or datasources)\n  hello-world (A project containing a controller, including a single vanilla Message and\n    a single remote method)\n  notes (A project containing a basic working example, including a memory database)\n~~~\nPress Enter to accept the default selection, `api-server`.\nThe generator will then display messages as it scaffolds the application including:\n~~~\n\n~~~\n1.\tInitializing the project folder structure.\n2.\tCreating default JSON files.\n3.\tCreating default JavaScript files.\n4.\tDownloading and installing dependent Node modules (as if you had manually done npm install).\nCreate models\nNow that you’ve scaffolded the initial project, you’re going to create a person model that will automatically have REST API endpoints.\nGo into your new application directory, then run the LoopBack model generator:\n ~~~\n$ cd getting-started-loopback\n~~~\n#### Model Information\n- Name: `person`\n  - Data source: `db (memory)`\n  - Base class: `PersistedModel`\n  - Expose over REST: `Yes`\n  - Custom plural form: *Leave blank*\n  - Properties:\n    - `name`\n      - String\n      - Required\n    - `description`\n      - String\n      - Required\nusing StrongLoop tools: sh $ slc loopback:model\nThe generator will prompt for a model name.  Enter `person`:\n~~~\n[?] Enter the model name: person\n~~~\nIt will ask if you want to attach the model to any data sources that have already been defined.  \nAt this point, only the default in-memory data source is available.  Press Enter to select it:\n ~~~\n...\n[?] Select the data-source to attach person to: (Use arrow keys)\n❯ db (memory)\n~~~\nThen the generator will prompt you for the base class to use for the model.  Since you will eventually connect this model to a persistent data source in a database, press down-arrow to choose PersistedModel, then press Enter:\n  ~~~\n[?] Select model's base class: (Use arrow keys)\n  Model\n❯ PersistedModel\n  ACL\n  AccessToken\n  Application\n  Change\n  Checkpoint\n~~~\nPersistedModel is the base object for all models connected to a persistent data source such as a database.\nOne of the powerful advantages of LoopBack is that it automatically generates a REST API for your model.  The generator will ask whether you want to expose this REST API.\nHit Enter again to accept the default and expose the Person model via REST: \n~~~\n[?] Expose person via the REST API? (Y/n) Y\n~~~\nLoopBack automatically creates a REST route associated with your model using the plural of the model name.  By default, it pluralizes the name for you (by adding “s”), but you can specify a custom plural form if you wish.  See Exposing models over REST for all the details.  \nPress Enter to accept the default plural form `(persons)`:\n~~~\n[?] Custom plural form (used to build REST URL):\n~~~\n \nNext, you’ll be asked whether you want to create the model on the server only or in the /common directory, where it can potentially be used by both server and client LoopBack APIs.  Keep, the default, common, even though in this application you’ll only be working with server-side models:\n ~~~\n? Common model or server only?\n❯ common\n  server\n~~~\nEvery model has properties.  Right now, you’re going to define one property, “name,” for the person model.  \nSelect string as the property type (press Enter, since string is the default choice):\n ~~~\nLet's add some person properties now.\nEnter an empty property name when done.\n[?] Property name: name\n   invoke   loopback:property\n[?] Property type: (Use arrow keys)\n❯ string\n  number\n  boolean\n  object\n  array\n  date\n  buffer\n  geopoint\n  (other)\n~~~\nEnd the model creation process by pressing Enter when prompted for the name of the next property.\nThe model generator will create two files in the application’s common/models directory that define the model: person.jsonand person.js.\nRun the application\nStart the application by node .:\n ~~~\n$ node .\n...\nBrowse your REST API at http://0.0.0.0:3000/explorer\nWeb server listening at: http://0.0.0.0:3000/\n~~~\nOpen your browser to http://0.0.0.0:3000/ (on some systems, you may need to use http://localhost:3000 instead).  You’ll see the default application response that displays some JSON with some status information; for example:\n{\"started\":\"2016-09-10T21:59:47.155Z\",\"uptime\":42.054}\nNow open your browser to http://0.0.0.0:3000/explorer or http://localhost:3000/explorer.  You’ll see the StrongLoop API Explorer:\n \n\n\n\nThrough a set of simple steps using LoopBack, you’ve created a `person` model, specified its properties and then exposed it through REST. \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhybridlogics%2Floopback-angular-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhybridlogics%2Floopback-angular-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhybridlogics%2Floopback-angular-setup/lists"}