Node. js framework StrongLoop Study Notes (1)

Source: Internet
Author: User

Node. js framework StrongLoop Study Notes (1)
Node. js framework StrongLoop Study Notes (1)

I am using node. js is used as the mobile phone background, and the search framework finds that StrongLoop is quite suitable, but it finds that there are no Chinese tutorials. So when you study on your own, take a note, for reference by other people like me (my English level is very poor, I can only try it a little bit and record it. If you find any problem, please notify me to correct it, thank you !). All operations are done in CentOS7-x64, Node. js 0.12.2.

Nodejs framework StrongLoop Study Notes 1 install StrongLoop Create Project install database driver configure database connection

Install StrongLoop

Npm install-g strongloop

Create a project in the working directory of the terminal (for example, my job is/home/work/strongloop, that is, cd/home/work/strongloop), enter slc loopback, and then prompt? What's the name of your application? (Strongloop)That is, let you enter the project name. The default directory name is project (for example, I enter study) and then prompt? Enter name of the directory to contain the project: (Study)That is, you can enter the directory name of the project. By default, the name of the project you just entered is the directory name (for example, you can directly add a vehicle here). Then StrongLoop will create a directory for you, and create the default project file and the default node. js module. After that, the project is created.
Appendix: You can also create a new directory under the working directory. The directory name is the project name, and then enter slc loopback. Press enter to create the default project file and the default node. js module. After that, the project is created. Install the database driver

Run npm install loopback-connector-mysql-save in the project directory. You can also add "dependencies" at the end of the package. json file in the project directory.,"loopback-connector-mysql": "^*"And then run npm install

The following databases are supported:
MongodbNpm install loopback-connector-mongodb-save
MysqlNpm install loopback-connector-mysql-save
OracleNpm install loopback-connector-oracle-save
PostgresqlNpm install loopback-connector-postgresql-save
RestNpm install loopback-connector-rest-save
SQL serverNpm install loopback-connector-mssql-save

Configure database connection

I. Command Line

Run the following command in the project directory, slc loopback:datasource; [?] Enter the data-source name:Enter the database connection configuration name; [?] 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 and edit the project directory/server/CES. in the json file, add host, port, database, username, password, and other items after "connector": "mysql" (the database type you selected), save and complete the settings.

Ii. webpage Interface

Run slc arc in the project directory. The StrongLoop web page is displayed in the browser.

Click Register below to enter StrongLoZ Register? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcNeisuHSu7j208rP5DwvcD4NCjxwPjxpbWcgYWx0PQ =" here write picture description "src =" http://www.bkjia.com/uploads/allimg/150419/044425E94-1.png "title =" \ "/>

StrongLoop will send a confirmation letter to the email address you entered, and complete registration through the connection. Then, use your registered email address and password to log on to the page management page of StrongLoop, and click Composer.

In the lower-left corner, select the database type you want to connect to. Here, mysql is used. configure a name for the database connection, for example, mysql. Then, enter the following database connection information, click Save Datasource to Save the configuration

Click Test Connection at the bottom to Test whether the configuration is correct. If the configuration is correct, the Success prompt will be displayed on the webpage.

Today, we are here to rest and rest!

Related Article

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.