You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ This is an opinionated base [Sails v1](https://sailsjs.com) application, using W
8
8
+ Setup for Webpack auto-reload dev server.
9
9
+ Setup so Sails will serve Webpack-built bundles as separate apps (so, a marketing site, and an admin site can live side-by-side).
10
10
+ Includes [react-bootstrap](https://www.npmjs.com/package/react-bootstrap) to make using Bootstrap styles / features with React easier.
11
+
+ Schema validation and enforcement for `PRODUCTION`. This repo is setup for `MySQL`. If you plan to use a different datastore, you will want to modify [`config/bootstrap.js`](config/bootstrap.js) (not to be confused with the CSS framework, this config file is what Sails runs just before finally "lifting". See [Sails documentation](https://sailsjs.com/config/bootstrap) about the `config/bootstrap.js` file.)
11
12
12
13
## How to Use
13
14
This repo is not installable via `npm`. It should be forked to help kick-start projects.
@@ -43,14 +44,29 @@ The webpack configuration can be found in the `config/webpack` folder. The major
43
44
## Building with React
44
45
React source files live in the `assets/src` folder. It is structured in such a way, where the `index.jsx` is really only used for local development (to help Webpack serve up the correct "app"). Then, there are the individual "apps", [main](assets/src/main.jsx) and [admin](assets/src/admin.jsx). These files are used as Webpack "[entry points](https://webpack.js.org/concepts/entry-points/)", to create 2 separate application bundles.
45
46
46
-
In a remote environment, Sails will look at the first subdirectory requested, and use that to determine which `index.html` file it needs to actually return. So, in this case, the "main" application will get built in `.tmp/public/main`, where the CSS is `.tmp/public/main/bundle.css`, the JavaScript is `.tmp/public/main/bundle.js`, and the HTML is `.tmp/public/main/index.html`. To view the main application, one would just go to `http://mydomain/` which gets redirected to `/main` (because need to know what application we are using), and now Sails will serve the `main` application. Where as, if one were to go to `http://mydomain/admin`, Sails would now serve the `admin` application bundle.
47
+
In a remote environment, Sails will look at the first subdirectory requested, and use that to determine which `index.html` file it needs to actually return. So, in this case, the "main" application will get built in `.tmp/public/main`, where the CSS is `.tmp/public/main/bundle.css`, the JavaScript is `.tmp/public/main/bundle.js`, and the HTML is `.tmp/public/main/index.html`. To view the main application, one would just go to `http://mydomain/` which gets redirected to `/main` (because we need to know what application we are using, we need a subdirectory), and now Sails will serve the `main` application. Whereas, if one were to go to `http://mydomain/admin`, Sails would now serve the `admin` application bundle (aka `.tmp/public/admin/index.html`).
47
48
48
-
### Links
49
+
## Schema Validation and Enforcement
50
+
Inside [`config/bootstrap.js`](config/bootstrap.js) is a bit of logic (**HEAVILY ROOTED IN NATIVE `MySQL` QUERIES**), which validates column types in the `PRODUCTION` database (aka `sails.config.models.migrate === 'safe'`), then will validate foreign key indexes. If there are too many columns, or there is a missing index, or incorrect column type, the logic will `console.error` any issues, then `process.exit(1)` (kill) the Sails server. The idea here, is that if anything is out of alignment, Sails will fail to lift, which will mean failure to deploy on AWS.
51
+
52
+
### If you do not want schema validation
53
+
... then replace the contents of `config/bootstrap.js` with the following:
54
+
55
+
```javascript
56
+
module.exports.bootstrap=function(next) {
57
+
// You must call the callback function, or Sails will fail to lift!
0 commit comments