Skip to content

Commit 593a8a3

Browse files
Fix readme
1 parent 7808652 commit 593a8a3

File tree

7 files changed

+34
-205
lines changed

7 files changed

+34
-205
lines changed

.docker/Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

.env.example

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
PORT=1337
33

44
# -- Database --
5-
POSTGRES_HOSTNAME=postgres
6-
POSTGRES_DB=postgres
7-
POSTGRES_PASSWORD=postgres
8-
POSTGRES_USER=postgres
9-
POSTGRES_POOL_SIZE=10
10-
POSTGRES_MIGRATIONS_TABLE_NAME=migrations
5+
MONGODB_URL=
6+
DATABASE=
117

128
# -- LOG LEVEL --
139
# DEBUG = 0

README.md

Lines changed: 32 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,32 @@
1-
# Deno starter API
2-
3-
- Added PostgreSQL db driver with ORM => https://deno.land/x/[email protected]
4-
- validation to endpoints
5-
- import_maps
6-
- dockerized
7-
8-
9-
## Install
10-
11-
Copy .env.example as .env in root directory.
12-
13-
Run ``./scripts/build-docker-image-local.sh `` to build docker image.
14-
15-
16-
Run ``docker-compose up api`` to run Deno.
17-
18-
19-
Run ``docker-compose up watch`` to run Deno in watch mode.
20-
21-
22-
Tip: For Apple M1 users for Deno watch mode we need to change in Dockerfile:
23-
24-
``FROM denoland/deno:1.15.3``
25-
26-
to this:
27-
28-
``FROM lukechannings/deno:latest``
29-
30-
and to docker-compose ``platform: linux/amd64``:
31-
32-
``
33-
services:
34-
watch:
35-
image: api:local
36-
hostname: api
37-
platform: linux/amd64
38-
volumes:
39-
...
40-
``
41-
42-
43-
## Migrations
44-
45-
Migrations are in `` migrations `` folder.
46-
47-
Syntax for class names is like in TypeORM:
48-
49-
File `` 20220124110458-init.ts `` then class should be named `` Init20220124110458 `` :
50-
File `` 20220130024421-fixes_on_post_users.ts `` then class should be named `` Fixes_on_post_users20220130024421 `` :
51-
52-
Files to migration folder we add manually.
53-
54-
"down" method is not supported yet.
55-
56-
Example migration file:
57-
58-
``
59-
import { Model } from "denodb";
60-
61-
export class Init20220124110458 {
62-
63-
async up(client: any): Promise<void> {
64-
await client.queryObject(`SELECT * FROM "migrations"`);
65-
}
66-
67-
async down(client: any): Promise<void> {
68-
await client.queryObject(`SELECT * FROM "migrations"`);
69-
}
70-
}
71-
``
1+
**Deploy via github action**
2+
1. Go to https://deno.com/deploy and Sign up/in
3+
2. Select Github repository
4+
3. Add Github Account
5+
4. Choose single repo or all repos
6+
5. Click again on Select Github repository
7+
6. Your name or organization
8+
7. Choose repo
9+
8. Select Production branch
10+
9. Select `main.ts` file
11+
10. Change name but it need to be unique
12+
11. Link and after few sec we have working app which will update after push to repo
13+
14+
**Deploying you project from local**
15+
16+
1. Go to https://deno.com/deploy and Sign up/in
17+
2. Click on your profile picture then "Access Tokens"
18+
3. Create and copy access token
19+
4. Go back to projects and create new project
20+
5. Choose Empty Project
21+
6. Copy name of your project
22+
7. Use `deployctl deploy --project=PROJECT_NAME --token=TOKEN --import-map=import_map.json src/index.ts`
23+
8. Check returned url
24+
9. If every thing is correct then use same command but add `--prod`
25+
10. App is now deployed and eveyone can access it :D
26+
27+
28+
**Endpoints**
29+
30+
GET /todos - list of all todos,
31+
POST /todo {text:'todo'} - create todo,
32+
PATCH /todo/:id - change todo's status

docker-compose.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

migrations/20220124110458-init.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

scripts.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

scripts/build-docker-image-local.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)