1 | # 🍅 Tomato
|
2 |
|
3 | This is our own take on the [express-generator](https://expressjs.com/en/starter/generator.html) CLI that comes with ExpressJS. We made this project because we always spend quite some time brining the default ExpressJS template up to speed. Especially when we have to constantly spin up new micro-services.
|
4 |
|
5 | A nice feature of this project is the simplicity on how you can customize it yourself. If you have your own style, you can just clone this repo and edit the `source` folder to your liking. But before you do that, check the list of features bellow. So... buckle up, scroll down and enjoy 🙂.
|
6 |
|
7 | # How to Install
|
8 |
|
9 | ```
|
10 | sudo npm install -g @0x4447/potato
|
11 | ```
|
12 |
|
13 | # How to go about this
|
14 |
|
15 | The `source` folder have 2 templates, one for when you need to build a Website in ExpressJS, and the other is when you need to build an API. In this case the API template is a striped down version of the Website folder, with some minor changes of course. Bellow you can check the list of all the shared features, but not limited to the features that they don't share in common.
|
16 |
|
17 | # Shared Key Features
|
18 |
|
19 | - Our personal commenting style that we like
|
20 | - Simplified and explained the `server` file so from the start you know what each line of code dose
|
21 | - By default we use clustering
|
22 | - Redesigned how errors are handled and displayed
|
23 | - By default we use Knex to talk with the database
|
24 | - Code that starts the server is in `workers` folder since it is a worker, and since we always end up with more the the server
|
25 | - End everything is organized how we like it :)
|
26 |
|
27 | ## Website
|
28 |
|
29 | - Redirect to HTTPS in production
|
30 | - By default we use compression when sending requests
|
31 | - By default we use Hogan for the templating - nice and simple
|
32 | - Favicon done right. Make your own five icon using [Real Favicon Generator](https://realfavicongenerator.net)
|
33 | - Basic Open Graph support
|
34 | - Twitter Cards support
|
35 |
|
36 | ## API
|
37 |
|
38 | - Throw error if there is no HTTPS in production
|
39 | - Remove the ETag from the header response
|
40 | - Removed the Data entry in the header response
|
41 | - Built in check for an API Key
|
42 |
|
43 | # The whole flow to have the project up and running is this:
|
44 |
|
45 | ```
|
46 | $ sudo npm -g install @0x4447/tomato
|
47 | ```
|
48 |
|
49 | Once you have this npm package installed globally, you can use it anywhere. Go to a folder where you want to create a new project and:
|
50 |
|
51 | ```
|
52 | $ tomato NAME_OF_THE_FOLDER
|
53 | ```
|
54 |
|
55 | Select the option that best suit your needs. Then you'll have to go in to the directory you just created and type:
|
56 |
|
57 | ```
|
58 | $ npm install
|
59 | ```
|
60 |
|
61 | Then you'll need to create a `.env` file to load your environment variables in to memory thanks to `foreman`, or you can also just install another tool that I made called [env-auto](https://www.npmjs.com/package/env-auto) like so:
|
62 |
|
63 | ```
|
64 | $ npm install cucumber -g
|
65 | ```
|
66 |
|
67 | and then in the root folder of your project type:
|
68 |
|
69 | ```
|
70 | $ cucumber
|
71 | ```
|
72 |
|
73 | to get the `.env` file automatically created from the `app.json` file. Last thing would be to start the whole thing with:
|
74 |
|
75 | ```
|
76 | $ npm start
|
77 | ```
|
78 |
|
79 | # WARNING
|
80 |
|
81 | This tool will override, destroy, kill and crash everything in its path - you've been warned ;)
|
82 |
|
83 | # Fork It
|
84 |
|
85 | This project was designed to allow you to make it your own - thanks to it simplicity. Once forked you just have to change the content of the `source` folder, and you have your own easy to use template up and running when you need it.
|
86 |
|
87 | # Why This Name?
|
88 |
|
89 | Why not? We had to call it something. And once you see it, you're not going to forget it. 😃
|
90 |
|
91 | # The End
|
92 |
|
93 | If you enjoyed this project, please consider giving it a 🌟. And check out our [0x4447 GitHub account](https://github.com/0x4447), where we have additional articles and tools that you might find interesting.
|
94 |
|
95 | # For Hire 👨💻
|
96 |
|
97 | If you'd like us to help you with something, please feel free to say hello@0x4447.com, and share what's on your mind. We'll take a look, and try our best to help you.
|