R3LM
A starter boilerplate for a universal webapp using React, Redux, Router, LoopBack and MongoDB.
Instructions
- Create a MongoDB data source connector to the MongoDB:
lb datasource mongoDS --connector mongoDB
- Follow the next step as an example to the data source and data base configuration.
Example
? Enter the datasource name: mongoDS
? Select the connector for mongoDS: MongoDB (supported by StrongLoop)
? Connection String url to override other settings (eg: mongodb://username:password@hostname:port/database):
? host: localhost
? port: 27017
? user:
? password:
? database: rrrlm
- Cleate a LoopBack new model:
lb model
- Give the new model a name:
? Enter the model name: rrrlm_model
? Select the datasource to attach rrrlm_model to: db (mongodb)
? Select model's base class PersistedModel
? Expose rrrlm_model via the REST API? Yes
? Custom plural form (used to build REST URL):
? Common model or server only? common
Let's add some rrrlm_model properties now.
- Create several properties:
Enter an empty property name when done.
? Property name: property_a
invoke loopback:property
? Property type: string
? Required? Yes
? Default value[leave blank for none]:
Let's add another rrrlm_model property.
Enter an empty property name when done.
? Property name: property_b
invoke loopback:property
? Property type: string
? Required? Yes
? Default value[leave blank for none]:
Let's add another rrrlm_model property.
Enter an empty property name when done.
? Property name: property_c
invoke loopback:property
? Property type: string
? Required? No
? Default value[leave blank for none]:
Let's add another rrrlm_model property.
Enter an empty property name when done.
? Property name:
Usage
- From the root folder, install the dependencies.
npm install
- To run the server and client
npm start
App
http://localhost:3000
Loopback Explorer:
http://localhost:3000/explorer
Mongo Shell
- Start MongoDB Shell by the following command:
mongo
- Next you have several useful
mongo
commands:
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
rrrlm 0.000GB
> use rrrlm
switched to db rrrlm
> show collections
rrrlm
> db.rrrlm.find()