or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
How to Deploy Your Node.js App to Heroku
Set up
node --version
. You need any version of Node greater than 10.npm --version
to make sure npm is there.heroku --version
command to verify your CLI installation. The output looks likeheroku/x.y.z
.Dependencies
npm init
in the root directory of your app to create apackage.json
. When an app is deployed, Heroku reads thepackage.json
to install the appropriate node version and thepackage-lock.json
to install the dependencies.npm install <pkg>
. This will install the package and also add it as a dependency in thepackage.json
file.Procfile & PORT variable
Procfile
(with no extensions). Use theProcfile
to explicitly declare what command should be executed to start your app.Procfile
in the app you deployed could look like thisThis command will use the
start
script that is specified in thepackage.json
.const PORT = process.env.PORT || 5000;
Run locally
heroku local
command.heroku local
examines theProcfile
to determine what to run.Your app should now be running on http://localhost:5000/.
Deploy the App
heroku login
command to log in to the Heroku CLI.heroku create
to create your app on Heroku.Heroku generates a random name for your app. You can rename an app at any time by either
heroku apps:rename
command:heroku apps:rename newname
OR
If you rename your app via Dashboard, run the following commands to update the remote’s details in other repository instances
git remote rm heroku
heroku git:remote -a newname
git push heroku main
to deploy your code.heroku ps:scale web=1
heroku open
to open the websiteYou can use
heroku logs --tail
to view information about your running app and Control+C to stop streaming the logs.