Skip to content

Commit 9726f0f

Browse files
committed
Readme update.
1 parent b0da59d commit 9726f0f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,31 @@ This is an opinionated base [Sails v1](https://sailsjs.com) application, using W
44

55
## Main Features
66

7-
+ [Automatic (incoming) request logging, via Sails models / hooks.](#request-logging)
8-
+ [Setup for Webpack auto-reload dev server.](#local-dev)
7+
+ Automatic (incoming) request logging, via Sails models / hooks.
8+
+ Setup for Webpack auto-reload dev server.
99
+ Setup so Sails will serve Webpack-built bundles as separate apps (so, a marketing site, and an admin site can live side-by-side).
1010
+ Includes [react-bootstrap](https://www.npmjs.com/package/react-bootstrap) to make using Bootstrap styles / features with React easier.
1111

12-
### Request Logging
12+
## Request Logging
1313
Automatic incoming request logging, is a 2 part process. First, the [`request-logger` hook](api/hooks/request-logger.js) gathers info from the quest, and creates a new [`RequestLog` record](api/models/RequestLog.js), making sure to mask anything that may be sensitive, such as passwords. Then, a custom response gathers information from the response, again, scrubbing sensitive data (using the [customToJSON](https://sailsjs.com/documentation/concepts/models-and-orm/model-settings?identity=#customtojson) feature of Sails models) to prevent leaking of password hashes, or anything else that should never be publicly accessible. The [`keepModelsSafe` helper](api/helpers/keep-models-safe.js) and the custom responses (such as [ok](api/responses/ok.js) or [serverError](api/responses/serverError.js)) are responsible for the final leg of request logs.
1414

15-
### Using Webpack
15+
## Using Webpack
1616
#### Local Dev
1717
The script `npm run open:client` will start the auto-reloading Webpack development server, and open a browser window.
1818

1919
#### Remote Builds
20-
The script `npm run build` will make Webpack build all the proper assets into the `.tmp` folder. Sails will serve assets from this folder.
20+
The script `npm run build` will make Webpack build all the proper assets into the `.tmp/public` folder. Sails will serve assets from this folder.
2121

2222
If you want to build assets, but retain spaces / tabs for debugging, you can use `npm run build:dev`.
2323

24+
#### Configuration
25+
The webpack configuration can be found in the `config/webpack` folder. The majority of the configuration can be found in [`common.config.js`](config/webpack/common.config.js). Then, the other 3 files, such as [`dev.config.js`](config/webpack/dev.config.js) extend the `common.config.js` file.
26+
27+
## Building with React
28+
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.
29+
30+
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.
31+
2432
### Links
2533

2634
+ [Sails Framework Documentation](https://sailsjs.com/get-started)

0 commit comments

Comments
 (0)