You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+89-73
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@
3
3
> 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.
4
4
5
5
-[**Create your database**](#create-your-database)
6
-
-[Deploy to **Heroku**](#deploy-to-heroku)
7
6
-[Deploy to **Glitch**](#deploy-to-glitch)
8
7
-[Deploy to **Azure**](#deploy-to-azure)
8
+
-[Deploy to **Heroku**](#deploy-to-heroku)
9
9
10
10
## Create your database
11
11
@@ -31,79 +31,7 @@ _this example will create `/posts` route , each resource will have `id`, `title`
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
53
34
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
-
constport=process.env.PORT||4000;
106
-
```
107
35
108
36
## Deploy to Glitch
109
37
@@ -185,3 +113,91 @@ You should be prompted to supply a password, this should be the pass to your acc
185
113
186
114
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>
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
+
constport=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)
0 commit comments