Skip to content

Commit bf3a95c

Browse files
committed
feat: switch to deno and hono 🎉
1 parent 1d0a7ce commit bf3a95c

File tree

18 files changed

+154
-5285
lines changed

18 files changed

+154
-5285
lines changed

.gitignore

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
### Deno ###
2+
/.idea/
3+
/.vscode/
4+
5+
/node_modules
6+
7+
.env
8+
*.orig
9+
*.pyc
10+
*.swp
11+
112
### Node ###
213
# Logs
314
logs
@@ -74,7 +85,6 @@ web_modules/
7485
.yarn-integrity
7586

7687
# dotenv environment variable files
77-
.env
7888
.env.development.local
7989
.env.test.local
8090
.env.production.local
@@ -138,9 +148,6 @@ dist
138148
# SvelteKit build / generate output
139149
.svelte-kit
140150

141-
### Vercel ###
142-
.vercel
143-
144151
### VisualStudioCode ###
145152
.vscode/*
146153
!.vscode/settings.json
@@ -184,21 +191,4 @@ $RECYCLE.BIN/
184191
*.msp
185192

186193
# Windows shortcuts
187-
*.lnk
188-
189-
### yarn ###
190-
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
191-
192-
.yarn/*
193-
!.yarn/releases
194-
!.yarn/patches
195-
!.yarn/plugins
196-
!.yarn/sdks
197-
!.yarn/versions
198-
199-
# if you are NOT using Zero-installs, then:
200-
# comment the following lines
201-
!.yarn/cache
202-
203-
# and uncomment the following lines
204-
# .pnp.*
194+
*.lnk

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 İbrahim Ödev
3+
Copyright (c) 2024 İbrahim Ödev
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
11
# Kandilli API
22

3-
[Kandilli Rasathanesi ve Deprem Araştırma Enstitüsü](http://www.koeri.boun.edu.tr/scripts/lst1.asp)'nün son depremler listesinin REST API halidir. Vercel REST API desteği üctretsiz olduğu sürece ücretsizdir. Hiçbir ticari amaç için kullanılmamaktadır. İletişim için [mail adresim](mailto:[email protected]).
3+
[Kandilli Rasathanesi ve Deprem Araştırma Enstitüsü](http://www.koeri.boun.edu.tr/scripts/lst1.asp)'nün son depremler listesinin REST API biçimidir. Ticari
4+
amaçlarla kullanılmaması gerekmektedir. İletişim için [mail adresim](mailto:[email protected]) üzerinden ulaşabilirsiniz.
45

5-
## Son 100 deprem
6+
## Son 500 deprem
67

7-
[https://kandilli-api.vercel.app/api](https://kandilli-api.vercel.app/api)
8-
9-
## Örnek Sorgu URL
10-
11-
[https://kandilli-api.vercel.app/api?sort=ml&minml=4&sehir=ELAZIG&limit=500](https://kandilli-api.vercel.app/api?sort=ml&minml=4&sehir=ELAZIG&limit=500)
12-
13-
500 deprem arasından ELAZIG şehrindeki minimum 4 büyüklüğündeki depremleri deprem büyüklüğüne göre sıralaması için bir sorgu.
14-
15-
## Filtrelemeler
16-
17-
Daha iyi veriler elde etmeniz için birkaç filtreleme ekledim.
18-
19-
### ?sehir=
20-
21-
Büyük harflerle ve ingilizce karakterlere uygun bir şekilde türkiyedeki şehirlerden herhangi birisine göre verileri sıralatabilirsiniz.
22-
23-
### ?limit=
24-
25-
`10` büyük ve `500` küçük olacak şekilde istediğiniz sayıda veri getirebilirsiniz. Varsayılan ```100```.
26-
27-
### ?sort=
28-
29-
En büyükten en küçüğe olacak şekilde sıralmasını istediğiniz anahtar değeri yazarasnız ona göre sıralar.
30-
31-
### ?minml=
32-
33-
Depremin büyüklük değeri olan ml nin minumum değerine göre verileri getirebilirsiniz.
8+
[https://kandilli.deno.dev/](https://kandilli.deno.dev/)

api/404.ts

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

api/index.ts

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

app.ts

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

deno.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"lock": false,
3+
"tasks": {
4+
"dev": "deno run --allow-all --watch main.ts",
5+
"check": "deno check **/*.ts",
6+
"deploy": "deployctl deploy",
7+
"deploy:prod": "deployctl deploy --prod"
8+
},
9+
"fmt": {
10+
"semiColons": true,
11+
"singleQuote": true,
12+
"lineWidth": 160
13+
},
14+
"compilerOptions": {
15+
"strict": true
16+
},
17+
"lint": {
18+
"rules": {
19+
"exclude": ["no-explicit-any"]
20+
}
21+
},
22+
"imports": {
23+
"deno-dom": "jsr:@b-fuze/deno-dom",
24+
"hono": "jsr:@hono/hono"
25+
},
26+
"deploy": {
27+
"project": "e10af582-079f-402c-be3c-407adf702279",
28+
"exclude": ["**/node_modules"],
29+
"include": [],
30+
"entrypoint": "main.ts"
31+
}
32+
}

dev-server.ts

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

main.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Hono } from 'hono';
2+
import { cors } from 'hono/cors';
3+
import { logger } from 'hono/logger';
4+
import { prettyJSON } from 'hono/pretty-json';
5+
import { secureHeaders } from 'hono/secure-headers';
6+
import indexRouter from './routes/index.ts';
7+
8+
const app = new Hono();
9+
10+
// Middlewares
11+
app.use('*', logger(), cors(), prettyJSON(), secureHeaders());
12+
13+
// Routes
14+
app.route('/', indexRouter);
15+
16+
app.notFound((c) => {
17+
return c.json({
18+
message: '404 Not Found',
19+
});
20+
});
21+
22+
app.onError((error, c) => {
23+
return c.json(error);
24+
});
25+
26+
const PORT = Number.parseInt(Deno.env.get('PORT') || '8000');
27+
28+
Deno.serve({
29+
port: PORT,
30+
onListen: ({ port }) => {
31+
console.info(`Listening on http://localhost:${port}`);
32+
},
33+
}, app.fetch);

package.json

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

0 commit comments

Comments
 (0)