wip links

This commit is contained in:
Nikita
2024-09-11 13:56:22 +03:00
parent 78d8b7c8d1
commit bb90e9eb47
5 changed files with 21 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
import { api, APIError } from "encore.dev/api"
import { api } from "encore.dev/api"
// import { startWorker } from "jazz-nodejs"
// import { ID } from "jazz-tools"
import { secret } from "encore.dev/config"
@@ -10,9 +10,9 @@ const jazzPublicGlobalGroup = secret("jazzPublicGlobalGroup")
export const testRoute = api(
{ expose: true, method: "GET", path: "/test" },
async ({}: {}): Promise<void> => {
console.log(jazzPublicGlobalGroup(), "group")
async ({}: {}): Promise<{ message: string }> => {
log.info("better logs from encore")
return { message: `Hello from encore` }
}
)

View File

@@ -2,18 +2,27 @@
// it is responsible for adding and getting links into LA from API
import { api, APIError } from "encore.dev/api"
// import { startWorker } from "jazz-nodejs"
import { startWorker } from "jazz-nodejs"
import { secret } from "encore.dev/config"
import log from "encore.dev/log"
const jazzWorkerSecret = secret("jazzWorkerSecret")
export const addPersonalLink = api(
export const saveLink = api(
{ expose: true, method: "POST", path: "/save-link" },
async ({ url }: { url: string }): Promise<void> => {
// TODO: perhaps apiKey only is enough?
async ({ url, email, apiKey }: { url: string; email: string; apiKey: string }): Promise<void> => {
// const { worker } = await startWorker({
// accountID: "co_zhvp7ryXJzDvQagX61F6RCZFJB9",
// accountSecret: JAZZ_WORKER_SECRET
// })
// log.info(jazzWorkerSecret)
if (!url.includes("http")) {
throw APIError.invalidArgument("url must include http")
}
log.info("addPersonalLink", { url })
}
)

Binary file not shown.

View File

@@ -1 +1,7 @@
Using [Encore](https://encore.dev).
## Run
```
encore run
```

BIN
bun.lockb

Binary file not shown.