Skip to content

Commit 3e20419

Browse files
updated README.md
1 parent 379b68b commit 3e20419

File tree

1 file changed

+89
-73
lines changed

1 file changed

+89
-73
lines changed

README.md

+89-73
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
> Instructions how to deploy the full fake REST API [json-server](https://github.com/typicode/json-server) to various free hosting sites. Should only be used in development purpose but can act as a simpler database for smaller applications.
44
55
- [**Create your database**](#create-your-database)
6-
- [Deploy to **Heroku**](#deploy-to-heroku)
76
- [Deploy to **Glitch**](#deploy-to-glitch)
87
- [Deploy to **Azure**](#deploy-to-azure)
8+
- [Deploy to **Heroku**](#deploy-to-heroku)
99

1010
## Create your database
1111

@@ -31,79 +31,7 @@ _this example will create `/posts` route , each resource will have `id`, `title`
3131

3232
---
3333

34-
## Deploy to **Heroku**
35-
36-
<img align="right" width="100px" height="auto" src="https://cdn.worldvectorlogo.com/logos/heroku.svg" alt="Heroku">
37-
38-
Heroku is a free hosting service for hosting small projects. Easy setup and deploy from the command line via _git_.
39-
40-
###### Pros
41-
42-
- Easy setup
43-
- Free
44-
45-
###### Cons
46-
47-
- App has to sleep a couple of hours every day.
48-
- "Powers down" after 30 mins of inactivity. Starts back up when you visit the site but it takes a few extra seconds. Can maybe be solved with [**Kaffeine**](http://kaffeine.herokuapp.com/)
49-
50-
---
51-
52-
### Install Heroku
5334

54-
1 . [Create your database](#create-your-database)
55-
56-
2 . Create an account on <br/>[https://heroku.com](https://heroku.com)
57-
58-
3 . Install the Heroku CLI on your computer: <br/>[https://devcenter.heroku.com/articles/heroku-cli](https://devcenter.heroku.com/articles/heroku-cli)
59-
60-
4 . Connect the Heroku CLI to your account by writing the following command in your terminal and follow the instructions on the command line:
61-
62-
```bash
63-
heroku login
64-
```
65-
66-
5 . Then create a remote heroku project, kinda like creating a git repository on GitHub. This will create a project on Heroku with a random name. If you want to name your app you have to supply your own name like `heroku create project-name`:
67-
68-
```bash
69-
heroku create my-cool-project
70-
```
71-
72-
6 . Push your app to **Heroku** (you will see a wall of code)
73-
74-
```bash
75-
git push heroku master
76-
```
77-
78-
7 . Visit your newly create app by opening it via heroku:
79-
80-
```bash
81-
heroku open
82-
```
83-
84-
8 . For debugging if something went wrong:
85-
86-
```bash
87-
heroku logs --tail
88-
```
89-
90-
---
91-
92-
#### How it works
93-
94-
Heroku will look for a startup-script, this is by default `npm start` so make sure you have that in your `package.json` (assuming your script is called `server.js`):
95-
96-
```json
97-
"scripts": {
98-
"start" : "node server.js"
99-
}
100-
```
101-
102-
You also have to make changes to the port, you can't hardcode a dev-port. But you can reference herokus port. So the code will have the following:
103-
104-
```js
105-
const port = process.env.PORT || 4000;
106-
```
10735

10836
## Deploy to Glitch
10937

@@ -185,3 +113,91 @@ You should be prompted to supply a password, this should be the pass to your acc
185113

186114
Choose **App Services** in the sidebar to the left and the choose your app in the list that appears then go to **Deployment Credentials** to change your password for deployment:<br>
187115
https://docs.microsoft.com/en-us/azure/app-service/app-service-deployment-credentials
116+
117+
## Deploy to **Heroku**
118+
119+
<img align="right" width="100px" height="auto" src="https://cdn.worldvectorlogo.com/logos/heroku.svg" alt="Heroku">
120+
121+
Heroku is a free hosting service for hosting small projects. Easy setup and deploy from the command line via _git_.
122+
123+
###### Pros
124+
125+
- Easy setup
126+
127+
###### Cons
128+
129+
- Premium
130+
- App has to sleep a couple of hours every day.
131+
- "Powers down" after 30 mins of inactivity. Starts back up when you visit the site but it takes a few extra seconds. Can maybe be solved with [**Kaffeine**](http://kaffeine.herokuapp.com/)
132+
133+
---
134+
135+
### Install Heroku
136+
137+
1 . [Create your database](#create-your-database)
138+
139+
2 . Create an account on <br/>[https://heroku.com](https://heroku.com)
140+
141+
3 . Install the Heroku CLI on your computer: <br/>[https://devcenter.heroku.com/articles/heroku-cli](https://devcenter.heroku.com/articles/heroku-cli)
142+
143+
4 . Connect the Heroku CLI to your account by writing the following command in your terminal and follow the instructions on the command line:
144+
145+
```bash
146+
heroku login
147+
```
148+
149+
5 . Then create a remote heroku project, kinda like creating a git repository on GitHub. This will create a project on Heroku with a random name. If you want to name your app you have to supply your own name like `heroku create project-name`:
150+
151+
```bash
152+
heroku create my-cool-project
153+
```
154+
155+
6 . Push your app to **Heroku** (you will see a wall of code)
156+
157+
```bash
158+
git push heroku master
159+
```
160+
161+
7 . Visit your newly create app by opening it via heroku:
162+
163+
```bash
164+
heroku open
165+
```
166+
167+
8 . For debugging if something went wrong:
168+
169+
```bash
170+
heroku logs --tail
171+
```
172+
173+
---
174+
175+
#### How it works
176+
177+
Heroku will look for a startup-script, this is by default `npm start` so make sure you have that in your `package.json` (assuming your script is called `server.js`):
178+
179+
```json
180+
"scripts": {
181+
"start" : "node server.js"
182+
}
183+
```
184+
185+
You also have to make changes to the port, you can't hardcode a dev-port. But you can reference herokus port. So the code will have the following:
186+
187+
```js
188+
const port = process.env.PORT || 4000;
189+
```
190+
191+
### Author Links
192+
193+
👋 Hello, I'm Ikram Ul Haq - Web Developer & Programmer
194+
195+
[Buy Me A Coffee](https://www.buymeacoffee.com/ikramdev)
196+
197+
🚀 Follow Me:
198+
199+
- [Twitter](https://twitter.com/ikramdeveloper)
200+
- [LinkedIn](https://www.linkedin.com/in/ikramdeveloper/)
201+
- [StackOverflow](https://stackoverflow.com/users/13859212/ikram-ul-haq)
202+
203+
---

0 commit comments

Comments
 (0)