Skip to content

Commit

Permalink
feat: ts-alias support
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrice8 committed Feb 9, 2024
1 parent 40d9b07 commit 85726af
Show file tree
Hide file tree
Showing 26 changed files with 344 additions and 187 deletions.
17 changes: 8 additions & 9 deletions examples/simple-ts/.config/servers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ servers:
plugin: '@ckenx/kenx-http'
key: 'default' # Optional value
HOST: 0.0.0.0
PORT: '[env]:PORT'
application: '[frameworks]:fastify-app'
PORT: '[env]:HTTP_PORT'
application: '[frameworks]:express-app'

# Socket.io server configurations
- type: 'socketio'
Expand All @@ -22,11 +22,10 @@ servers:
# Vite server configurations
- type: 'vite'
plugin: '@ckenx/kenx-vite'
PORT: 8000
HOST: 0.0.0.0
PORT: '[env]:VITE_PORT'
# bindTo: 'http:default'
# adapter: '[databases]:redis-db'
# options:
# cookie: false
# allowEIO3: true
# serveClient: true
# connectTimeout: 15000
builder: true
options:
root: './src/views'
appType: 'custom' # spa, mpa, custom
22 changes: 0 additions & 22 deletions examples/simple-ts/.env.dev

This file was deleted.

3 changes: 2 additions & 1 deletion examples/simple-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@ckenx/kenx-mongodb": "*",
"@ckenx/kenx-mysql": "*",
"@ckenx/kenx-routing": "*",
"@ckenx/kenx-socketio": "*"
"@ckenx/kenx-socketio": "*",
"@ckenx/kenx-vite": "*"
}
}
3 changes: 1 addition & 2 deletions examples/simple-ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ServerPlugin, DatabasePlugin } from '../../../packages/node/dist/types'
import type http from 'http'
import type io from 'socket.io'
import routes from './routes'
import routes from '#routes/index'

// Export const takeover = ['http', 'socketio', 'database:*']

Expand Down Expand Up @@ -36,7 +36,6 @@ export default async ( http: ServerPlugin<http.Server>, io: io.Server, databases
// Add fastify middleware
.use( async ( req: any, res: any ) => {
console.log('-- Middleware --')

// Test session
req.session.name = 'Bob'
})
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions examples/simple-ts/src/views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Vite in %MODE% mode</h1>
9 changes: 8 additions & 1 deletion examples/simple-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
"skipLibCheck": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node"
"moduleResolution": "node",
"baseUrl": "src",
"paths": {
"#routes/*": ["routes/*"]
}
},
"ts-node": {
"require": ["tsconfig-paths/register"]
}
}
Loading

0 comments on commit 85726af

Please sign in to comment.