Foreman is a pretty cool tool for using things like databases and other web modules.
Here is the process for installing and using it. First of all navigate to your directory of choice and type either:
Unix
Windows.
Then in your app you need to make a file called a Procfile, it is a standard text file, so just type “touch Procfile” to create it.
In the Procfile you will need to state what you want foreman to do when you start it, so in mine I have the following.
This tells foreman to start app.js with node when I type “foreman start”
Last but not least if you are using things like online databases then you will need to use environment variables. Foreman uses a file called “.env” so “touch .env” in the directory to create it.
in .env the structure is this “MY_ENVIRONMENT_VARIABLE=blahblahblah”
then in your code just add “process.env.MY_ENVIRONMENT_VARIABLE" to use it.
Good Day
No comments:
Post a Comment