Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
basemkhirat committed Nov 11, 2017
2 parents e29e89d + e7de017 commit 84d1e7f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ All application configuration files are stored here grouped by its functionalite
`cors.js` setting the Cross-Origin Resource Sharing protection.


In production environment. we always need a different configuration parameters that what the `config/env.js` do.
In production environment. we always need a different configuration parameters that what the `config/env` directory do.

The application gets the enviroment stored in `app.js` file and load the evironment file. So if we are working in `production` environment, the application will automatically load the configuration file `config/env/production.js` and uses its defined items to override items stored outside.

Expand All @@ -56,7 +56,7 @@ module.exports = {
}
```

We can access configuration using the `_config` object. so if we want to get the environment key we call `_config('app.env')`.
We can access configuration using the `_config()` function. so if we want to get the environment key we call `_config('app.env')`.

## Public directory

Expand All @@ -66,7 +66,7 @@ Here we can put our static files such as image, css, js, uploads and other clien

Contains the MVC folder structure:

`controllers` are modules. each of them exports an object of methods that accepts request and response.
`controllers` are modules. each of them exports an object of methods that accept request and response.

```javascript
# HomeController.js
Expand Down Expand Up @@ -98,7 +98,9 @@ router.get("/", HomeController.index);
module.exports = router;
```

`models` define the mongoose collection models that interact directly to database.
`Note` api routes defined in `api.js` are prefixed by default with the value of configuation `_config.app.api_prefix`;

`models` define the mongoose collection models that interact directly with database.

```javascript
# User.js
Expand Down Expand Up @@ -130,10 +132,6 @@ The default engine is `ejs`. You can change views settings from `app.js`

```

`Note` api routes defined in `api.js` are prefixed by default with the value of configuation `_config.app.api_prefix`;



`middlewares` are functions that have access to the request object (req), the response object (res), and the next middleware function in the application’s request-response cycle. The next middleware function is commonly denoted by a variable named next.

```javascript
Expand Down Expand Up @@ -249,7 +247,7 @@ _url("css/style.css");

This application comes with two type of authentication methods:

`session` for working with server side rendering applications which authentication is stored in session and browser cookie.
`session` for working with server side rendering applications which authentication meta data is stored as session files on server and cookies in browser and browser sends this cookie with any request.

You can set the session using `login` function

Expand Down

0 comments on commit 84d1e7f

Please sign in to comment.