Skip to content

opprDev/R3LM

Repository files navigation

R3LM

A starter boilerplate for a universal webapp using React, Redux, Router, LoopBack and MongoDB.

Instructions

  1. Create a MongoDB data source connector to the MongoDB:
lb datasource mongoDS --connector mongoDB
  1. 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
  1. Cleate a LoopBack new model:
lb model
  1. 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.
  1. 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

  1. From the root folder, install the dependencies.
npm install
  1. To run the server and client
npm start

App

http://localhost:3000

Loopback Explorer:

http://localhost:3000/explorer

Mongo Shell

  1. Start MongoDB Shell by the following command:
mongo
  1. 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()

Sponsors