node. JS Framework Strongloop Learning notes (i)

Source: Internet
Author: User

node. JS Framework Strongloop Learning notes (i)

I am using node. js to do the phone backstage, find the framework found Strongloop quite suitable, but found no Chinese tutorial, so in their own study, do a note, to facilitate other people like me reference (my english level is very poor, only a little try to do, and record down, if you find the problem, please inform me good correction, Thanks, man. )。 All operations are done under Centos7-x64,node.js 0.12.2.

    • Nodejs Frame Strongloop Learning Note one
      • Installing Strongloop
      • Create a project
      • Installing Database Drivers
      • Configure Database connections

Installing Strongloop

NPM install-g Strongloop

Create a project
    1. In the terminal into the working directory (for example: My job is/home/work/strongloop, ie cd/home/work/strongloop), input SLC loopback
    2. Then prompt? What ' s the name of your application? (Strongloop) , which lets you enter the project name, the default directory name is the project (for example: I enter study)
    3. Then prompt? Enter name of the directory to contain the project: (study) , which allows you to enter the catalog name of the item, the project name that you just entered is the directory name (for example: if you add a car here directly)
    4. Next Strongloop will create the directory for you and create the default project file and the default node. js module, after which the project is finished.
      attached : You can also create a new directory directly under the working directory, the directory name on the project name, and then enter the SLC loopback; directly enter, the default project file and the default node. JS module are created, and the project is finished after completion.
Installing Database Drivers

Execute in the project directory, NPM install Loopback-connector-mysql–save, or at the end of the "dependencies" in the project directory's Package.json file ,"loopback-connector-mysql": "^*" , and then execute NPM Install

The following databases are supported:
MongoDB npm Install Loopback-connector-mongodb–save
mysql npm install Loopback-connector-mysql–save
Oracle NPM Install Loopback-connector-oracle–save
PostgreSQL npm Install Loopback-connector-postgresql–save
rest npm Install Loopback-connector-rest–save
SQL Server npm install Loopback-connector-mssql–save

Configure Database connections

First, the command line mode

    1. Executed under the project directory slc loopback:datasource ;
    2. [?] Enter the data-source name:Enter the database connection configuration name;
    3. [?] Select the connector for mysqlDS: (Use arrow keys)
      other
      In-memory db (supported by StrongLoop)
      MySQL (supported by StrongLoop)
      PostgreSQL (supported by StrongLoop)
      Oracle (supported by StrongLoop)
      Microsoft SQL (supported by StrongLoop)
      MongoDB (supported by StrongLoop)
      (Move up and down to reveal more choices)

      Select your database type
    4. Edit the project directory/server/datasources.json file, in the "connector": "MySQL" (Here is the database type you selected) after adding host, port, database, username and password and other items, Save, set up.

Second, the Web interface mode

Execute in project directory, SLC Arc; Open the Strongloop Web management interface in the browser

Click on register below to enter Strongloop register a mailbox

Strongloop will send you a confirmation letter to fill in the mailbox, through the inside of the connection to complete the registration; then log in with your registered email and password to the Strongloop page management interface, click Composer

In the lower left corner select the type of database you want to connect to, I am here MySQL; and configure a name for the database connection, as I call MySQL here; then fill in the following database connection information, point to save datasource saving configuration

Click on the bottom of the test connection testing configuration is correct, if correct will be prompted on the Web page success

Come here today, rest and rest!

node. JS Framework Strongloop Learning notes (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.