Skip to content

Commit ca5ac6f

Browse files
committed
feat(init): init project
1 parent 9b3abf2 commit ca5ac6f

39 files changed

+1474
-0
lines changed

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: ['https://i.loli.net/2020/07/23/pOlJvQMhAouSmUn.png'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/workspace.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
name: Deno-web-api
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: denolib/setup-deno@v2
16+
with:
17+
deno-version: v1.x
18+
- run: make test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
data

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Deno",
6+
"type": "node",
7+
"request": "launch",
8+
"cwd": "${workspaceFolder}",
9+
"runtimeExecutable": "deno",
10+
"runtimeArgs": ["run", "--inspect-brk", "-A", "./src/index.ts"],
11+
"outputCapture": "std",
12+
"port": 9229
13+
}
14+
]
15+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"sqltools.connections": [
3+
{
4+
"askForPassword": false,
5+
"database": "postgres",
6+
"driver": "PostgreSQL",
7+
"name": "RBAC",
8+
"password": "000000",
9+
"port": 5432,
10+
"previewLimit": 50,
11+
"server": "localhost",
12+
"username": "postgres"
13+
}
14+
]
15+
}

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Deno Restful API With PostgreSql & TDD
2+
3+
## init DB
4+
5+
### Start DB
6+
7+
```shell
8+
make db
9+
```
10+
11+
### Connect DB in pgadmin
12+
13+
Open browser [http://localhost:9099](http://localhost:9099), username/password is [email protected]/000000
14+
15+
|Host|UserName|Password|DB|
16+
|--|--|--|--|
17+
|host.docker.internal|postgres|0|postgres|
18+
19+
## 1.Run
20+
21+
Run up backend with below command
22+
23+
```shell
24+
$ make dev
25+
...
26+
```
27+
28+
## 2.VSCode Debug
29+
30+
Press `F5` key;
31+
32+
## 3.Bundle & Run
33+
34+
```shell
35+
make bundle
36+
```
37+
38+
## 4.更新依赖
39+
40+
> Ref: https://nugine.github.io/deno-manual-cn/linking_to_external_code/integrity_checking.html
41+
42+
```shell
43+
make updateDeps
44+
```
45+
46+
### 5.协作者
47+
48+
```shell
49+
make cache
50+
```
51+
52+
## Ref
53+
54+
* [oak](https://oakserver.github.io/oak/)
55+
* [Creating your first REST API with Deno and Postgres](https://blog.logrocket.com/creating-your-first-rest-api-with-deno-and-postgres/)
56+
* [oak test](https://github.com/oakserver/oak/blob/f293b6f8df1b2fbf27ae0c69424e05fbda887521/context_test.ts#L36)
57+
* [Learn Deno](https://ahmadawais.com/deno/)
58+
* [API Testing and Debugging in Deno](https://www.youtube.com/watch?v=ICWr-j6OF3U)
59+
60+
## 👍
61+
62+
![赞赏](./pay.png)

_resources/IaaS/docker-compose.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3.8'
2+
services:
3+
db:
4+
image: postgres:12
5+
environment:
6+
POSTGRES_USER: postgres
7+
POSTGRES_PASSWORD: 0
8+
POSTGRES_DB: postgres
9+
ports:
10+
- 5432:5432
11+
volumes:
12+
- ./data:/var/lib/postgresql/data
13+
pgadmin:
14+
image: dpage/pgadmin4
15+
environment:
16+
PGADMIN_DEFAULT_EMAIL: '[email protected]'
17+
PGADMIN_DEFAULT_PASSWORD: '000000'
18+
ports:
19+
- 9099:80
20+
depends_on:
21+
- db

_resources/httpClient/addUser.http

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
POST http://localhost:8000/api/v1/users HTTP/1.1
2+
Content-Type: application/x-www-form-urlencoded
3+
4+
name=foo&password=123
5+
6+
7+
8+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
GET http://localhost:8000/api/v1/health HTTP/1.1
2+
3+
4+
5+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GET http://localhost:8000/api/v1/users HTTP/1.1
2+
Content-Type: application/json
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GET http://localhost:8000/api/v1/users/9d935e40-3477-471e-bfe9-f713709380c5 HTTP/1.1
2+
Content-Type: application/json
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE public."user"
2+
(
3+
id uuid NOT NULL,
4+
username character varying(50) NOT NULL,
5+
registration_date timestamp without time zone,
6+
password character varying(20) NOT NULL,
7+
deleted boolean
8+
);

deps.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export {
2+
Application,
3+
Router,
4+
Response,
5+
Status,
6+
Request,
7+
RouteParams,
8+
Context,
9+
RouterContext,
10+
helpers,
11+
send,
12+
} from "https://deno.land/x/oak/mod.ts";
13+
export { Client } from "https://deno.land/x/postgres/mod.ts";
14+
export {
15+
assertEquals,
16+
assertNotEquals,
17+
assert,
18+
assertMatch,
19+
equal,
20+
assertThrows,
21+
assertThrowsAsync,
22+
} from "https://deno.land/std/testing/asserts.ts";
23+
export * from "https://deno.land/x/postgres/mod.ts";
24+
export { v4 } from "https://deno.land/std/uuid/mod.ts";
25+
export {
26+
spy,
27+
Spy,
28+
stub,
29+
Stub,
30+
resolves,
31+
} from "https://raw.githubusercontent.com/udibo/mock/master/mod.ts";

examples/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>trest</title>
8+
</head>
9+
10+
<body>
11+
test
12+
<script>
13+
fetch("http://localhost:8000/api/v1/users", {
14+
method: "POST",
15+
body: 'name=foo&password=123',
16+
headers: {
17+
'Content-Type': 'application/x-www-form-urlencoded',
18+
Accept: 'application/json',
19+
},
20+
mode: "same-origin",
21+
}).then(response => response.json())
22+
.then(json => {
23+
console.log(json)
24+
})
25+
</script>
26+
</body>
27+
28+
</html>

lock.json

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"https://deno.land/std/_util/assert.ts": "e1f76e77c5ccb5a8e0dbbbe6cce3a56d2556c8cb5a9a8802fc9565af72462149",
3+
"https://deno.land/std/fmt/colors.ts": "eb606cfb06e3f03a0222f09768a9701de2dd31c1fc8fa3a939137792a472962a",
4+
"https://deno.land/std/hash/sha1.ts": "a887e14efc6c8d17b062647dc5eff07b8d8ed446eb7f994d69ae0e808db31e65",
5+
"https://deno.land/std/node/_util/_util_callbackify.ts": "50f980fafc0b12172ba53b26036835f55dd3296b46556a227f8616b0682179e0",
6+
"https://deno.land/std/node/_util/_util_promisify.ts": "35f7b8a4123d3a44b1aa349ada9b671fb096cb1144520482767ed72a8799708f",
7+
"https://deno.land/std/node/_util/_util_types.ts": "217a4c1055289f25d1dc9097638aeeb7662136d34e6f49df5f27038872dc8d6f",
8+
"https://deno.land/std/node/_utils.ts": "786b4f364609c8066dda897a9557d00c2a3a48e884ad734549c2ced692509d97",
9+
"https://deno.land/std/node/util.ts": "2399b5b640683221cdab13ac94e0c16d62f74d5ba80ef2313aed731a9b0ab1d4",
10+
"https://deno.land/std/testing/asserts.ts": "1e9f87e0ecc456caa00a95f3345c5a7aeea0a4bf25c443a54341d9f6e36e5edf",
11+
"https://deno.land/std/testing/diff.ts": "b685fb818c3527f0890628711934863672de2e94f01db421731654243f1eac8f",
12+
"https://deno.land/std/uuid/_common.ts": "6fd4cb11fb959d6181fe91e7e0be77a91a0aee4dfea5fbc6cb768f1b56404298",
13+
"https://deno.land/std/uuid/mod.ts": "3b37d4e0e75891caa5c63c79dedb68a5f449b6c4e9f57ec4e57e385099674030",
14+
"https://deno.land/std/uuid/v1.ts": "67dbf98aa6378ee2fa5d4c9758df5c6f7fc9680ee32e245a197a42bbf42c7afa",
15+
"https://deno.land/std/uuid/v4.ts": "6452fea17180252ba181f93be2b35ddccb156130f2d07c5539f097b6a172f7ee",
16+
"https://deno.land/std/uuid/v5.ts": "eb1a657916f9d7bc88e216cd9f7d23b30c5eee46915a2df14bc6ac392e21bbca",
17+
"https://deno.land/[email protected]/_util/assert.ts": "e1f76e77c5ccb5a8e0dbbbe6cce3a56d2556c8cb5a9a8802fc9565af72462149",
18+
"https://deno.land/[email protected]/_util/has_own_property.ts": "91a2ef2fae5d941643a6472b97cac7ed8060a96deb66f4fafb4a2750c8af18e5",
19+
"https://deno.land/[email protected]/async/deferred.ts": "ac95025f46580cf5197928ba90995d87f26e202c19ad961bc4e3177310894cdc",
20+
"https://deno.land/[email protected]/async/delay.ts": "35957d585a6e3dd87706858fb1d6b551cb278271b03f52c5a2cb70e65e00c26a",
21+
"https://deno.land/[email protected]/async/mod.ts": "bf46766747775d0fc4070940d20d45fb311c814989485861cdc8a8ef0e3bbbab",
22+
"https://deno.land/[email protected]/async/mux_async_iterator.ts": "f6ca1b70f05e3cb676956d70a3230c99925288cf67e4e0b0bbaf34759b41945b",
23+
"https://deno.land/[email protected]/bytes/mod.ts": "b1a149ac741728db00bda9ce1a2d044f248edd5ac95e708a6cc501bfd3adb4a7",
24+
"https://deno.land/[email protected]/encoding/utf8.ts": "8654fa820aa69a37ec5eb11908e20b39d056c9bf1c23ab294303ff467f3d50a1",
25+
"https://deno.land/[email protected]/fmt/colors.ts": "06444b6ebc3842a4b2340d804bfa81fc5452a03513cbb81bd7f6bf8f4b8f3ac4",
26+
"https://deno.land/[email protected]/hash/sha1.ts": "c1a97bde767b98b88495470f39c30c37e44ac3984409f120ef65fd84c9d27608",
27+
"https://deno.land/[email protected]/hash/sha256.ts": "1aedfb09bcb067929de6ad78f3b074b802ec94ec96c8a07b80475d90942cb221",
28+
"https://deno.land/[email protected]/http/_io.ts": "7a31bf7d0167685d8d0ff4eca93b558cd26539695d1ddbd715ee28bf1dc7db17",
29+
"https://deno.land/[email protected]/http/http_status.ts": "0ecc0799a208f49452023b1b927106ba5a2c13cc6cf6666345db028239d554ab",
30+
"https://deno.land/[email protected]/http/server.ts": "3bae933acb2645d863f0f87a91070d2478ad24b828ce27936711377426896b29",
31+
"https://deno.land/[email protected]/io/bufio.ts": "dd1fc575524fe8b44e128091ba0e6833be7d0966336ef12a407544440b762e17",
32+
"https://deno.land/[email protected]/io/ioutil.ts": "9f434a266181e6bd03ff1cd4d30163637655422f26d147c397d9305b904cb40d",
33+
"https://deno.land/[email protected]/path/_constants.ts": "e11f32a36644e04dce243f3c1f30c02cc5d149827f48a755628176f0707cfc70",
34+
"https://deno.land/[email protected]/path/_globrex.ts": "696996deed47bd98fcab9de0034233380ead443a5cd702631151c6a71e3d21a2",
35+
"https://deno.land/[email protected]/path/_interface.ts": "5876f91d35fd42624893a4aaddaee352144e1f46e719f1dde6511bab7c3c1029",
36+
"https://deno.land/[email protected]/path/_util.ts": "76f73f9b4a994e2859e9d4544cfc34f0ff21b48893c65023025e572c21a43542",
37+
"https://deno.land/[email protected]/path/common.ts": "e4ec66a7416d56f60331b66e27a8a4f08c7b1cf48e350271cb69754a01cf5c04",
38+
"https://deno.land/[email protected]/path/glob.ts": "ff5c4d04d643083dc5c8a46da83b8c836934155c2a7ad72675c43092b2a435ea",
39+
"https://deno.land/[email protected]/path/mod.ts": "6de8885c2534757097818e302becd1cefcbc4c28ac022cc279e612ee04e8cfd1",
40+
"https://deno.land/[email protected]/path/posix.ts": "2ed477953d037fd42d077822e6db0adaa8dcc4ce1cfbb673b0a49ce1c1c301ff",
41+
"https://deno.land/[email protected]/path/separator.ts": "9dd15d46ff84a16e13554f56af7fee1f85f8d0f379efbbe60ac066a60561f036",
42+
"https://deno.land/[email protected]/path/win32.ts": "e4f0b577346f0936d92b6473369248773db217ce385295024a6875e559376e43",
43+
"https://deno.land/[email protected]/testing/asserts.ts": "e12228748a139acfbf00c3ef6022fefd9fc265d7c2034368bad2cd80099c76df",
44+
"https://deno.land/[email protected]/testing/diff.ts": "77338e2b479626c096278d7b4a95f750753ee39558f314db6b794e8d8a98d515",
45+
"https://deno.land/[email protected]/textproto/mod.ts": "ee6bad9818d3fb44ecb2e0bbf9fc5b6a871fb332145800c54f732bf805dddff2",
46+
"https://deno.land/[email protected]/ws/mod.ts": "7063b3f6b9fcd4ef766c35b0588c85c4160999ef70a4cef92377d709848d8b52",
47+
"https://deno.land/x/[email protected]/hash.ts": "00b68d85a69cc93fc3256dc79749e36b17a7e84dcc89277844d854d90ff0110c",
48+
"https://deno.land/x/[email protected]/md5.ts": "2c5865aed4ae8ded0c631a5813e87453b4a3696ce23f3738c475ff7f96f5236a",
49+
"https://deno.land/x/[email protected]/mod.ts": "c3f22c227cd45bf7d54b677285c19da9496071f6c1ac57bf90ae82ebf25868e5",
50+
"https://deno.land/x/[email protected]/sha1.ts": "5769e11a1c47f2c52c1be16c97c50a476e9ae4f5497bf3e66ed09032aac779db",
51+
"https://deno.land/x/[email protected]/db.ts": "56a9deab286b6283e1df021d74ee3319353f27f7827716b6443427fff2fc6e24",
52+
"https://deno.land/x/[email protected]/deps.ts": "e9b3da67c55907c7206abff65b36be9d483089c3c33385994a6507a35a8d769c",
53+
"https://deno.land/x/[email protected]/mod.ts": "94141d7c415fcdad350fec9d36d77c18334efe25766db6f37d34709c896881ed",
54+
"https://deno.land/x/oak/application.ts": "545b6e1d00803fecab14f32c4e3dfda919c97d5ef674a3cd1f9cf2f555494beb",
55+
"https://deno.land/x/oak/body.ts": "18497f073a789f4d84625b8b697b3c1257743902fc8d2fe82e1a37f5bb0a63c4",
56+
"https://deno.land/x/oak/buf_reader.ts": "ced6a04ac8f529a18e1e85182ffe0cf82ee9477e1a8f5441a02e923f62bebc54",
57+
"https://deno.land/x/oak/content_disposition.ts": "1504bb85669e6c7e6dd30210fa7e73c55aa40195ed40a090f4ad58568c2b9882",
58+
"https://deno.land/x/oak/context.ts": "506f2c42657becf9a45ffb02efc6d131eb55f2364950c0ce209d9272586c3711",
59+
"https://deno.land/x/oak/cookies.ts": "af291cb64ae0ccc40e6d777980d89d694e971131222130b1b11e9200b9cae6f1",
60+
"https://deno.land/x/oak/deps.ts": "662171164099115030cd44a535601ce02451a1afb1acdf4af9ebfc8841913eaa",
61+
"https://deno.land/x/oak/headers.ts": "3fcd4efee596dc8a22f37ba9b96e6d4e277b1f9c2b9994be5af14761d99afe90",
62+
"https://deno.land/x/oak/helpers.ts": "ffc907c49368dcbe591f0bfee122a354b3a66def9621de48e06bbbdefe913b3d",
63+
"https://deno.land/x/oak/httpError.ts": "7e09654eb5e0843beca87934b9fea7a8af79f9da0cd15c220197e7c619a96708",
64+
"https://deno.land/x/oak/isMediaType.ts": "77b94675822d7de7f6af21bb765ed9f25b956c7ac4d292dd66c2ecb9ea9478e5",
65+
"https://deno.land/x/oak/keyStack.ts": "a490066c90cbfea6b7de73303b9530e68ffbe86ff48b99ff17dab1cc9cf0751f",
66+
"https://deno.land/x/oak/mediaTyper.ts": "042b853fc8e9c3f6c628dd389e03ef481552bf07242efc3f8a1af042102a6105",
67+
"https://deno.land/x/oak/middleware.ts": "024640237d616319c964524412cfd3b2add6c88c6cb05468b09b459121cacc19",
68+
"https://deno.land/x/oak/mod.ts": "948cbd62197a8b73449d553b599794af7ed5e94964105d20f89e91db87f2c966",
69+
"https://deno.land/x/oak/multipart.ts": "b79a61ea535c308c81e3ef5b60e9aa3c0b9ebcd6cad55d8c8f2ac852247fb927",
70+
"https://deno.land/x/oak/negotiation/charset.ts": "b4c2e0c49dd5122f130f95bf29508448d983c424801b5bc304b00288b5ae3195",
71+
"https://deno.land/x/oak/negotiation/common.ts": "f54d599d37408005f8c565d0f6505de51fed31feaa3654a7758e2359c006b02c",
72+
"https://deno.land/x/oak/negotiation/encoding.ts": "b6b351150dfaa37d43c1e4679f0afa7ee70c2fa775d8bc8b9e9baf15bcf65888",
73+
"https://deno.land/x/oak/negotiation/language.ts": "62ef13ea3146538dd52a4666611bd423ebb9a6438e7312398e17a4d16dbafb51",
74+
"https://deno.land/x/oak/negotiation/mediaType.ts": "7e25cc34600beea3bf0b0879ff1783c752260fcb517dffea2e122830c36e8451",
75+
"https://deno.land/x/oak/request.ts": "4e4c8b9b7b0b9c01730299078fe61613a1d0ab800e56656cabb339a013dbc5e7",
76+
"https://deno.land/x/oak/response.ts": "5cdbb5aa3a040e4dba2995c69f129148b3f05cbf41fdb1b305306034b75b19e6",
77+
"https://deno.land/x/oak/router.ts": "a6953bf13592a65b154a9b64cc6b1fe73f273432f92786d013dc670b4631dec1",
78+
"https://deno.land/x/oak/send.ts": "a79b640e7c64c702c618158a2185897adb0ac7d28842d85bb0fab81716fc137d",
79+
"https://deno.land/x/oak/server_sent_event.ts": "9a70da986c367c4689a6d3c8e9015e883ff0a1d6b0d451e20b9caf0c6a01cae5",
80+
"https://deno.land/x/oak/tssCompare.ts": "bb88898156aad3157c30eebf87bc7312a2099f099c135090a937734fd8a15978",
81+
"https://deno.land/x/oak/types.d.ts": "635b03a2620763bcaded852888c319ed34b80a76a16e0b28e6670ffe93630338",
82+
"https://deno.land/x/oak/util.ts": "76c06927cdca5a2db6b986890fa6c8c72772b9c4ae03c4f12cbb6d19461206a9",
83+
"https://deno.land/x/postgres/array_parser.ts": "ceac035ccf8909deb951ad47452440c304db7431448a62853c32863d5a92f96a",
84+
"https://deno.land/x/postgres/client.ts": "43af61797c8ac93c1a1a728c165b1828e6ecd993ed19d10a250e99a4cd28a94c",
85+
"https://deno.land/x/postgres/connection.ts": "4c50e0e55703d0c6bc0a53e5208066b3d305f3d0d3073fae6e0caa366b720fe0",
86+
"https://deno.land/x/postgres/connection_params.ts": "038b05a12c2fd2fe7d9cbad53d9f941e7aa461e8e2bfea720b986887a6bd35b9",
87+
"https://deno.land/x/postgres/decode.ts": "4f6926c6f9c03ca357073a51e51dcde77cef74fef67b5f47d7a4e6bc8038c7c4",
88+
"https://deno.land/x/postgres/deferred.ts": "de077878ddaf09829679d08a20b94be91ceba64ce261e5f5e2bc1f621dea3b4c",
89+
"https://deno.land/x/postgres/deps.ts": "a13bba60736e127ecd52ff9b517449bfe6b1f2a5fb0e1e3e37f4a46deda3accf",
90+
"https://deno.land/x/postgres/encode.ts": "5f490a348268cbff9af1cadba51b21a06fdc10e5480f5efef78f57b80f470e9b",
91+
"https://deno.land/x/postgres/error.ts": "c803a457606f42b08b7599db50d980f5944451e3683944ec5dd0041fbde3d4d1",
92+
"https://deno.land/x/postgres/mod.ts": "3b942841a2070dd08c30dd18dec099a66256e1358a2425cd334dd00faf8e68a7",
93+
"https://deno.land/x/postgres/oid.ts": "90ff200a59195240b250c7e2b86ae95bc40a9b76f677aaa456d19d91d2698c7b",
94+
"https://deno.land/x/postgres/packet_reader.ts": "f35ac560f349c61fd97e1216278a1f05bb4ff2910afaf34bc158460b458ccd13",
95+
"https://deno.land/x/postgres/packet_writer.ts": "1b5a0b7371743477e8cac88d9016ecf0b3900c4393075f0efdd2cfa3f87fdbdd",
96+
"https://deno.land/x/postgres/pool.ts": "795925a739786c34f5cc685ae5c29576726e9a957ce2ce05185707d852ae8abb",
97+
"https://deno.land/x/postgres/query.ts": "9618e5846be4103fae38976ccbb2f4f064f315655f11dea174b64497688ae87c",
98+
"https://deno.land/x/postgres/utils.ts": "184fc14e3213d2acd06c906c49fb90ea57f73ed11c539964c8a8a6620af626da",
99+
"https://raw.githubusercontent.com/pillarjs/path-to-regexp/v6.1.0/src/index.ts": "8747ddaf85a761df4059cbc48a78cf710106f6b4c9d6932feb4d35120ac0990a",
100+
"https://raw.githubusercontent.com/udibo/mixins/v0.3.0/apply.ts": "0066f0185d90a4d88702207f0ddc9e5178541ac6720a5e4c741d5873331863db",
101+
"https://raw.githubusercontent.com/udibo/mock/master/deps/udibo/mixins/apply.ts": "2f2b77b62ef1428c81728bd31a4c037d84d4257d02bb44f7d914d352b16c2cbf",
102+
"https://raw.githubusercontent.com/udibo/mock/master/mod.ts": "e5e395d0add66329bf93d8679cd75c21330e17cde79f5881fe7ecc2503c6f6cd",
103+
"https://raw.githubusercontent.com/udibo/mock/master/spy.ts": "d8c0dc3b03d107b0e64cf175a1d9eaf5659579b1cbb237102e09aac790594b58",
104+
"https://raw.githubusercontent.com/udibo/mock/master/stub.ts": "cc4ee153530b8899fc2b6bcda953c35f0ef84e7840b873e8b976a762410dccd8"
105+
}

makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
dev:
2+
deno run --allow-net --allow-env ./src/index.ts
3+
4+
test:
5+
deno test --allow-env --allow-net -L info
6+
7+
db:
8+
cd ./_resources/Iaas && docker-compose up -d
9+
10+
bundle:
11+
mkdir dist
12+
deno bundle src/index.ts dist/platform.js
13+
14+
start:
15+
APP_PORT=1234 deno run --allow-net --allow-env ./dist/platform.js
16+
17+
updateDeps:
18+
deno cache --lock=lock.json --lock-write ./deps.ts
19+
20+
cache:
21+
deno cache -r --lock=lock.json ./deps.ts

pay.png

772 KB
Loading

src/Utils/client.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Client } from "../../deps.ts";
2+
import {
3+
DB_HOST,
4+
DB_DATABASE,
5+
DB_PORT,
6+
DB_USER,
7+
DB_PASSWORD,
8+
} from "../config.ts";
9+
10+
const client = new Client({
11+
hostname: DB_HOST,
12+
database: DB_DATABASE,
13+
user: DB_USER,
14+
password: DB_PASSWORD,
15+
port: DB_PORT,
16+
});
17+
18+
export default client;

0 commit comments

Comments
 (0)