-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'contextual-pubsub' into dev
- Loading branch information
Showing
10 changed files
with
167 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
import dotenv from 'dotenv' | ||
if(process.env.NODE_ENV !== 'production'){ | ||
dotenv.config() | ||
import dotenv from "dotenv"; | ||
if (process.env.NODE_ENV !== "production") { | ||
dotenv.config(); | ||
} | ||
|
||
|
||
import { createClient } from 'redis'; | ||
import { createClient } from "redis"; | ||
|
||
class RedisClient { | ||
|
||
constructor() { | ||
throw new Error('Use Singleton.getInstance()'); | ||
|
||
throw new Error("Use Singleton.getInstance()"); | ||
} | ||
|
||
static getInstance() { | ||
if (!RedisClient.client) { | ||
RedisClient.client = createClient({ | ||
url: process.env.REDIS_CONNECTION_STRING | ||
}); | ||
} | ||
return RedisClient.client; | ||
if (!RedisClient.client) { | ||
RedisClient.client = createClient({ | ||
url: process.env.REDIS_CONNECTION_STRING, | ||
}); | ||
} | ||
return RedisClient.client; | ||
} | ||
|
||
static getPubSubInstance() { | ||
if (!RedisClient.pubsub) { | ||
RedisClient.pubsub = createClient({ | ||
url: process.env.REDIS_CONNECTION_STRING, | ||
}); | ||
} | ||
return RedisClient.pubsub; | ||
} | ||
} | ||
|
||
export default RedisClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComposeDBService } from "../services/composedb.js"; | ||
|
||
export const createWebPage = async (req, res, next) => { | ||
const definition = req.app.get("runtimeDefinition"); | ||
const modelFragments = req.app.get("modelFragments"); | ||
const castFragment = modelFragments.filter( | ||
(fragment) => fragment.name === "FarcasterCast", | ||
)[0]; | ||
|
||
//todo get fragment | ||
try { | ||
const composeDBService = new ComposeDBService( | ||
definition, | ||
castFragment, | ||
).setSession(req.session); | ||
|
||
const cast = await composeDBService.createNode({ | ||
...req.body, | ||
}); | ||
|
||
res.status(201).json(cast); | ||
} catch (error) { | ||
res.status(500).json({ error: error.message }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5863,6 +5863,13 @@ express-joi-validation@^5.0.1: | |
resolved "https://registry.yarnpkg.com/express-joi-validation/-/express-joi-validation-5.0.1.tgz#ded03f35ba5d95b57da6ebe22b2b6d2e4ab074c4" | ||
integrity sha512-BztcU64addcAdxys2j42pZVSnJjEyFaLxNko7YSYDUuEBtKq2XnhzYZuy9ex9Q+Fdhef+NwLXhX1djwZmShCLg== | ||
|
||
express-ws@^5.0.2: | ||
version "5.0.2" | ||
resolved "https://registry.yarnpkg.com/express-ws/-/express-ws-5.0.2.tgz#5b02d41b937d05199c6c266d7cc931c823bda8eb" | ||
integrity sha512-0uvmuk61O9HXgLhGl3QhNSEtRsQevtmbL94/eILaliEADZBHZOQUAiHFrGPrgsjikohyrmSG5g+sCfASTt0lkQ== | ||
dependencies: | ||
ws "^7.4.6" | ||
|
||
express@^4.18.2: | ||
version "4.19.2" | ||
resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" | ||
|
@@ -10271,7 +10278,7 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" | ||
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== | ||
|
||
ws@^7.5.1: | ||
ws@^7.4.6, ws@^7.5.1: | ||
version "7.5.9" | ||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" | ||
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters