Skip to content

Commit 6c5e1ca

Browse files
updated readme file
1 parent d83e674 commit 6c5e1ca

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

README.md

+27-16
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22

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
5-
* [**Create your database**](#create-your-database)
6-
* [Deploy to **Heroku**](#deploy-to-heroku)
7-
* [Deploy to **Glitch**](#deploy-to-glitch)
8-
* [Deploy to **Azure**](#deploy-to-azure)
5+
- [**Create your database**](#create-your-database)
6+
- [Deploy to **Heroku**](#deploy-to-heroku)
7+
- [Deploy to **Glitch**](#deploy-to-glitch)
8+
- [Deploy to **Azure**](#deploy-to-azure)
99

1010
## Create your database
1111

12-
1. Press the green `Use this template`-button in the right corner
12+
1. Press the green `Use this template`-button in the right corner of [this repo](https://github.com/jesperorb/json-server-heroku)
1313
2. Give your new repo a name and press the green `Create repository from template`-button
1414
3. Clone your newly created repository to your computer
1515

1616
4 . Change the contents of `db.json` to **your own content** according to the [`json-server example`](https://github.com/typicode/json-server#example) and then `commit` your changes to git locally.
1717

1818
_this example will create `/posts` route , each resource will have `id`, `title` and `content`. `id` will auto increment!_
19+
1920
```json
2021
{
21-
"posts":[
22+
"posts": [
2223
{
23-
"id" : 0,
24+
"id": 0,
2425
"title": "First post!",
25-
"content" : "My first content!"
26+
"content": "My first content!"
2627
}
2728
]
2829
}
@@ -38,13 +39,13 @@ Heroku is a free hosting service for hosting small projects. Easy setup and depl
3839

3940
###### Pros
4041

41-
* Easy setup
42-
* Free
42+
- Easy setup
43+
- Free
4344

4445
###### Cons
4546

46-
* App has to sleep a couple of hours every day.
47-
* "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/)
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/)
4849

4950
---
5051

@@ -57,26 +58,31 @@ Heroku is a free hosting service for hosting small projects. Easy setup and depl
5758
3 . Install the Heroku CLI on your computer: <br/>[https://devcenter.heroku.com/articles/heroku-cli](https://devcenter.heroku.com/articles/heroku-cli)
5859

5960
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+
6062
```bash
6163
heroku login
6264
```
6365

6466
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+
6568
```bash
6669
heroku create my-cool-project
6770
```
6871

69-
6 . Push your app to __Heroku__ (you will see a wall of code)
72+
6 . Push your app to **Heroku** (you will see a wall of code)
73+
7074
```bash
7175
git push heroku master
7276
```
7377

7478
7 . Visit your newly create app by opening it via heroku:
79+
7580
```bash
7681
heroku open
7782
```
7883

7984
8 . For debugging if something went wrong:
85+
8086
```bash
8187
heroku logs --tail
8288
```
@@ -86,13 +92,15 @@ heroku logs --tail
8692
#### How it works
8793

8894
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+
8996
```json
9097
"scripts": {
9198
"start" : "node server.js"
9299
}
93100
```
94101

95102
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+
96104
```js
97105
const port = process.env.PORT || 4000;
98106
```
@@ -104,9 +112,9 @@ Not tested 100%. Same as with Heroku, will sleep after a while.
104112
1. Register for [Glitch](https://glitch.com/) or go to [Glitch/edit](https://glitch.com/)
105113
2. Click **New Project**
106114
3. Click **Import from GitHub**
107-
4. Paste `https://github.com/jesperorb/json-server-heroku.git` into the URL-input and click OK.
115+
4. Paste `https://github.com/ikramdeveloper/json-server-deploy` into the URL-input and click OK.
108116
5. Wait for it to setup
109-
6. Press **Share**-button to get your URL to live site. It should be something for example like: `https://fallabe-pie-snake.glitch.me`. And your DB will be at `https://fallabe-pie-snake.glitch.me/posts`
117+
6. Press **Share**-button to get your URL to live site. It should be something for example like: `https://seemly-truthful-scribe.glitch.me/`. And your DB will be at `https://seemly-truthful-scribe.glitch.me/posts`
110118

111119
## Deploy to **Azure**
112120

@@ -126,11 +134,12 @@ https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
126134
_This might cause some trouble, you will see. Remember to restart your terminal or maybe your computer if the commands after this does not work_
127135

128136
3 . Login to the service via the command line and follow the instructions: </br>
137+
129138
```bash
130139
az login
131140
```
132-
_You will be prompted to visit a website and paste a confirmation code_
133141

142+
_You will be prompted to visit a website and paste a confirmation code_
134143

135144
## Create the project
136145

@@ -149,6 +158,7 @@ az appservice plan create -n NameOfServicePlan -g NameOfResourceGroup
149158
```
150159

151160
4 . Create the actual app and supply the service plan and resource group
161+
152162
```bash
153163
az webapp create -n NameOfApp -g NameOfResourceGroup --plan NameOfServicePlan
154164
```
@@ -166,6 +176,7 @@ git remote add azure https://[email protected]/depl
166176
```
167177

168178
7 . Now you should be able to push your app:
179+
169180
```bash
170181
git push azure master
171182
```

0 commit comments

Comments
 (0)