|
| 1 | +# Your First App |
| 2 | + |
| 3 | +Well alright! Let's build your first Feathers app! We're going to build a real-time chat app with MongoDB as the database. It's a great way to cover all the things that you'd need to do in a real world application and how Feathers can help. It also makes a lot more sense to have a real-time component than a Todo list. 😉 |
| 4 | + |
| 5 | +If you've already gone through the [Quick Start](quick-start.md) section you can skip ahead to [What Just Happened?](#what-just-happened). |
| 6 | + |
| 7 | +## Generate Your App |
| 8 | + |
| 9 | +Make sure you have NodeJS and npm installed. You can grab these from the [NodeJS](https://nodejs.org) website or if you are on OS X and have homebrew installed by running `brew install nodejs`. |
| 10 | + |
| 11 | +Install the Yeoman and the Feathers generator. |
| 12 | + |
| 13 | +> `npm install -g yeoman generator-feathers` |
| 14 | +
|
| 15 | +Create a directory for your new app. |
| 16 | + |
| 17 | +> `mkdir feathers-chat; cd feathers-chat/` |
| 18 | +
|
| 19 | +Generate your app and follow the prompts. |
| 20 | + |
| 21 | +`yo feathers` |
| 22 | + |
| 23 | +When presented with the project name just hit enter. |
| 24 | + |
| 25 | +<img src="./assets/step1.png" alt="App Name Prompt"> |
| 26 | + |
| 27 | +Enter in a short description of your app. |
| 28 | + |
| 29 | +<img src="./assets/step2.png" alt="App Description Prompt"> |
| 30 | + |
| 31 | +You can now choose which providers you want to support. Since we're setting up a real-time REST API we'll go with the default REST and Socket.io. So just hit enter. |
| 32 | + |
| 33 | +You can learn more about Feathers providers in [Providers chapter](providers/readme.md). |
| 34 | + |
| 35 | +<img src="./assets/step3.png" alt="Transport Prompt"> |
| 36 | + |
| 37 | +Next we'll be prompted to support [CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). This basically allows your client to connect to the sever from wherever. You can whitelist specific domains but again, just hit enter for now. |
| 38 | + |
| 39 | +<img src="./assets/step4.png" alt="CORs Prompt"> |
| 40 | + |
| 41 | +Now let's choose our database. You can see that Feathers supports a bunch through the generator and we support even more outside the generator. Let's choose MongoDB. You can find out more about our database adapters in the [Databases chapter](databases/readme.md). |
| 42 | + |
| 43 | +<img src="./assets/step5.png" alt="Database Prompt"> |
| 44 | + |
| 45 | +Since pretty much every app needs authentication of some sort we generate almost everything you need to get going. We currently only support local authentication but have plans for social auth as well. |
| 46 | + |
| 47 | +You can learn more about authentication in Feathers by reading the [Authentication chapter](authentication/readme.md). |
| 48 | + |
| 49 | +<img src="./assets/step6.png" alt="Authentication Prompt"> |
| 50 | + |
| 51 | +Your options should all look like this and you should have seen that a whole bunch of files were created. |
| 52 | + |
| 53 | +<img src="./assets/step7.png" alt="Final Configuration"> |
| 54 | + |
| 55 | +npm will do it's thing and install your dependencies. Depending on your Internet connection this can take a minute or two. So while this is happening you should start your mongodb instance. |
| 56 | + |
| 57 | +If you are running on OSX or Linux and already have MongoDB installed simply run: |
| 58 | + |
| 59 | +`mongod` |
| 60 | + |
| 61 | +Once your dependencies have been installed you can start your brand new app! 💥 |
| 62 | + |
| 63 | +`npm start` |
| 64 | + |
| 65 | +## What Just Happened |
| 66 | + |
| 67 | + |
| 68 | + |
0 commit comments