Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate from fastify to hono #37

Merged
merged 29 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
982d24a
chore: upgrade packages
SeanCassiere Jun 23, 2024
6055567
feat: create a basic hono server
SeanCassiere Jun 23, 2024
9f01057
chore: cleanup
SeanCassiere Jun 23, 2024
7a8a381
build: get the build working
SeanCassiere Jun 23, 2024
7370449
chore: organize the package.json
SeanCassiere Jun 23, 2024
dab3188
feat: getting all logs without authentication
SeanCassiere Jun 23, 2024
e8a5137
feat: get all logs with authentication
SeanCassiere Jun 23, 2024
542054a
feat: create log for authenticated req
SeanCassiere Jun 23, 2024
5aa3f51
feat: add health check
SeanCassiere Jun 23, 2024
d755e7e
feat: middleware 🎉
SeanCassiere Jun 23, 2024
3c0388e
feat: deleting logs
SeanCassiere Jun 23, 2024
256e556
refactor: match consistency
SeanCassiere Jun 23, 2024
fc52297
feat: get services for admin
SeanCassiere Jun 23, 2024
a281350
feat: create a service
SeanCassiere Jun 23, 2024
04ee497
feat: get service by id
SeanCassiere Jun 23, 2024
2bd4321
feat: disable service
SeanCassiere Jun 23, 2024
fb84c6b
feat: enable service
SeanCassiere Jun 23, 2024
627c38c
fix: compat for the authentication header name
SeanCassiere Jun 23, 2024
288ebac
feat: move the routers into their own folder
SeanCassiere Jun 23, 2024
7c43bdb
feat: api documentation
SeanCassiere Jun 23, 2024
23310d4
feat: cors
SeanCassiere Jun 23, 2024
184a44d
style: ordering
SeanCassiere Jun 23, 2024
bce39c6
feat: coerce numbers for search params
SeanCassiere Jun 23, 2024
cef0c81
feat: update documentation
SeanCassiere Jun 23, 2024
f36a937
feat: use yaml
SeanCassiere Jun 23, 2024
805264b
feat: restore readme
SeanCassiere Jun 23, 2024
e96c70c
chore: update readme
SeanCassiere Jun 23, 2024
9ad8227
feat: update the openapi transformer
SeanCassiere Jun 23, 2024
6772b0f
feat: handle dirs not existing
SeanCassiere Jun 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ dist
.pnp.*

#
.DS_Store
.DS_Store
ignore/
public/static/openapi.v*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ This is a dead simple log server that allows you to log messages to a persisted
## Development

1. Clone the repository.
2. Install dependencies `npm install`.
2. Install dependencies `pnpm install`.
3. Create a `.env` file and add the necessary `secrets` into it. You can use the `.env.example` file as a reference.
4. Run the development server using `npm run dev`. If you haven't run an init on your database, run `npm run db:push`.
4. Run the development server using `pnpm run dev`. If you haven't run an init on your database, run `pnpm run db:push`.

## Usage

Expand All @@ -17,7 +17,7 @@ OpenAPI 3 specification with Swagger explorer is available at `/docs`.

To make any logs into the database, you'll need a valid service account which is active. These account should be regulated by yourself, and should not generated by the public.

You can use the `npm run db:explorer` to view the database, and create a service.
You can use the `pnpm run db:explorer` to view the database, and create a service.

### Endpoints

Expand Down
38 changes: 20 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "simple-logging-server",
"version": "2.2.0",
"license": "MIT",
"version": "2.3.0",
"description": "This is a simple API for logging messages",
"author": "Sean Cassiere",
"keywords": [],
"private": true,
"main": "dist/index.js",
"packageManager": "[email protected]",
"main": "dist/index.js",
"scripts": {
"lint": "eslint --max-warnings=0 src",
"lint:fix": "eslint --fix --max-warnings=0 src",
Expand All @@ -14,39 +17,38 @@
"test": "vitest --typecheck",
"test:ci": "vitest run --typecheck",
"build:kill-dist": "rimraf ./dist",
"build:code": "tsc",
"build:code": "tsc && tscpaths -p tsconfig.json -s ./src -o ./dist",
"build": "pnpm run build:kill-dist && pnpm run build:code",
"postbuild": "node postbuild.mjs",
"db:explorer": "drizzle-kit studio",
"db:migrate-generate": "drizzle-kit generate:pg",
"db:migrate-run": "tsx ./migrator.ts"
},
"keywords": [],
"author": "Sean Cassiere",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.14.3",
"@types/node": "^20.14.8",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"drizzle-kit": "^0.22.7",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"pg": "^8.11.3",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"tsx": "^4.15.6",
"typescript": "^5.3.3",
"pg": "^8.12.0",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"tscpaths": "^0.0.9",
"tsx": "^4.15.7",
"typescript": "^5.5.2",
"vitest": "^1.6.0"
},
"dependencies": {
"@fastify/rate-limit": "^9.1.0",
"@hono/node-server": "^1.11.4",
"@paralleldrive/cuid2": "^2.2.2",
"dotenv": "^16.3.1",
"@scalar/hono-api-reference": "^0.5.77",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.31.2",
"fastify": "^4.25.2",
"fastify-zod": "^1.4.0",
"hono": "^4.4.7",
"hono-rate-limiter": "^0.3.0",
"postgres": "^3.4.4",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.3"
"zod": "^3.23.8"
}
}
Loading