diff --git a/package.json b/package.json index 6b6c419..3971776 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "clean": "rimraf ./dist", - "dev:web": "vite", + "dev:web": "vite --host", "dev:server": "tsx --watch ./src/server/index.ts", "dev": "concurrently --kill-others -n Server,Web -c bgGreen,bgBlue \"npm run dev:server\" \"npm run dev:web\"", "build:web": "vue-tsc --noEmit && vite build", diff --git a/src/server/lib/hello.ts b/src/server/lib/hello.ts deleted file mode 100644 index 3a93859..0000000 --- a/src/server/lib/hello.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function hello(name: string) { - if (name === 'test') throw new Error('Test error') - - console.log(`Hello ${name}!`) - - return { message: `Hello ${name}!` } -} diff --git a/src/server/lib/login.ts b/src/server/lib/login.ts new file mode 100644 index 0000000..fb5561a --- /dev/null +++ b/src/server/lib/login.ts @@ -0,0 +1,4 @@ +export function login(username: string, password: string) { + console.log('Login', username, password) + return 'ok' +} diff --git a/src/server/trpc.ts b/src/server/trpc.ts index f230f6c..08cca63 100644 --- a/src/server/trpc.ts +++ b/src/server/trpc.ts @@ -2,11 +2,11 @@ import { initTRPC, inferAsyncReturnType } from '@trpc/server' import * as trpcExpress from '@trpc/server/adapters/express' import { z } from 'zod' -import { hello } from './lib/hello' +import { login } from './lib/login' // Created for each request function createContext({ req, res }: trpcExpress.CreateExpressContextOptions) { - return { ip: req.ip } + return { ip: req.ip, hostname: req.hostname } } type Context = inferAsyncReturnType @@ -14,14 +14,17 @@ type Context = inferAsyncReturnType export const t = initTRPC.context().create() export const appRouter = t.router({ - hello: t.procedure.input(z.string()).query(({ input }) => { - return hello(input) - }), - myIp: t.procedure.query(({ ctx }) => { const ip = ctx.ip.split(':').slice(-1)[0] - return ip - }) + console.log(`IP: ${ip}, Hostname: ${ctx.hostname}`) + + return { ip, hostname: ctx.hostname } + }), + login: t.procedure + .input(z.object({ username: z.string(), password: z.string() })) + .mutation(async ({ input }) => { + return login(input.username, input.password) + }) }) // export type definition of API diff --git a/src/web/App.vue b/src/web/App.vue index 946f642..e34bd3c 100644 --- a/src/web/App.vue +++ b/src/web/App.vue @@ -1,29 +1,7 @@ - + diff --git a/src/web/assets/logo.png b/src/web/assets/logo.png deleted file mode 100644 index a5f23ae..0000000 Binary files a/src/web/assets/logo.png and /dev/null differ diff --git a/src/web/assets/logo.svg b/src/web/assets/logo.svg deleted file mode 100644 index d57771c..0000000 --- a/src/web/assets/logo.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/web/components/HelloWorld.vue b/src/web/components/HelloWorld.vue deleted file mode 100644 index 6775d4d..0000000 --- a/src/web/components/HelloWorld.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - diff --git a/src/web/components/LoginForm.vue b/src/web/components/LoginForm.vue new file mode 100644 index 0000000..0cc5067 --- /dev/null +++ b/src/web/components/LoginForm.vue @@ -0,0 +1,76 @@ + + + diff --git a/src/web/plugins/vuetify.ts b/src/web/plugins/vuetify.ts index c276519..dd7ebe7 100644 --- a/src/web/plugins/vuetify.ts +++ b/src/web/plugins/vuetify.ts @@ -13,14 +13,22 @@ import { createVuetify } from 'vuetify' // https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides export default createVuetify({ + defaults: { + VCard: { + elevation: 20 + } + // VBtn: { + // color: 'primary' + // } + }, theme: { themes: { light: { colors: { primary: '#1867C0', - secondary: '#5CBBF6', - }, - }, - }, - }, + secondary: '#5CBBF6' + } + } + } + } }) diff --git a/src/web/router/index.ts b/src/web/router/index.ts index 65353da..62689d7 100644 --- a/src/web/router/index.ts +++ b/src/web/router/index.ts @@ -8,19 +8,20 @@ const routes = [ children: [ { path: '', - name: 'Home', + name: 'Login', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. - component: () => import(/* webpackChunkName: "home" */ '@/views/Home.vue'), - }, - ], - }, + component: () => + import(/* webpackChunkName: "home" */ '@/views/Login.vue') + } + ] + } ] const router = createRouter({ history: createWebHistory(process.env.BASE_URL), - routes, + routes }) export default router diff --git a/src/web/views/Home.vue b/src/web/views/Home.vue deleted file mode 100644 index 7646ab7..0000000 --- a/src/web/views/Home.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/src/web/views/Login.vue b/src/web/views/Login.vue new file mode 100644 index 0000000..b052757 --- /dev/null +++ b/src/web/views/Login.vue @@ -0,0 +1,9 @@ + + +