From c64862a881be0975a76ba38da4714ee8baa6d82a Mon Sep 17 00:00:00 2001 From: Iago Bruno Date: Sat, 7 Dec 2019 03:29:02 -0300 Subject: [PATCH] docs: Update routing docs --- docs/routing/README.md | 44 +++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/docs/routing/README.md b/docs/routing/README.md index 334dd10c..4e4aaa82 100644 --- a/docs/routing/README.md +++ b/docs/routing/README.md @@ -41,25 +41,51 @@ project/ **Tip:** `$` is used by Bash for variables. So it might be confusing when you do `cd $username` or `mkdir $username` and nothing happens. The right way to do this is escaping the `$` ie. `cd \$username` or `mkdir \$username`. -## .zeroignore file +## Entry Point + +By default, Zero compiles and serves all files in your project. As your project grows, you may want to organize them in one folder so that they don't mix with other config files. Zero lets you enter a main folder where it should get the routes. + +Poject structure example: + +``` +project/ +└── docs/ +└── shared/ +└── www/ + └── about.html + └── index.js +└── data.js +``` + +Point the folder you want to expose: -By default, Zero compiles and serves all files in your project. But most of the time, you don't want to expose a certain file or folder. You can add `.zeroignore` file to prevent Zero from serving that file as a valid route. +``` +zero www +``` + +Now only files inside the `www` folder will be served. Important to note they will be available at the root of the domain, like `http:///about`. + +**Tip:** You can point multiple folders. -### Example +## .zeroignore file + +You can also indicate specific files or folders to prevent them from being exposed. -In a project with following structure: +Example, In a project with following structure: ``` -- project/ --- components/ --- api/ --- index.jsx +project/ +└── components/ +└── api/ +└── index.js ``` -You probably don't want to expose `components` directory. To do this, you can create `.zeroignore` file with the following text: +You probably don't want to expose `components` directory. To do this, create an `.zeroignore` file in the project root with the following text: ``` components ``` This will prevent your users from accessing `/components` path directly. + +**Tip:** This file works just like [`.gitignore`](https://git-scm.com/docs/gitignore).