-
Notifications
You must be signed in to change notification settings - Fork 19
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 node server side #18
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
add requestContext, fix cookie parser add middleware
cookie middleware working
@@ -1,5 +1,6 @@ | |||
import { ABBY_BASE_URL } from "./constants"; | |||
import type { AbbyEventType, AbbyEvent, AbbyDataResponse } from "./index"; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
@@ -48,6 +48,11 @@ interface PersistentStorage { | |||
set: (key: string, value: string) => void; | |||
} | |||
|
|||
type flagCacheConfig = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done in another PR? maybe finish that one first? =)
packages/core/tests/base.test.ts
Outdated
@@ -121,8 +121,146 @@ describe("Abby", () => { | |||
|
|||
expect(abby.getFeatureFlag("flag1")).toBe(false); | |||
}); | |||
|
|||
it("refetches an expired flag", async () =>{ | |||
const date = new Date() //current date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment says nothing, why dont we use ;
in here? Oo
const date = new Date() //current date | |
const date = new Date(); |
@@ -7,5 +7,6 @@ export default defineConfig({ | |||
clean: true, | |||
sourcemap: true, | |||
treeshake: true, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
import { Request } from "express"; | ||
import { FastifyRequest } from "fastify"; | ||
|
||
// type RequestType<T> = T extends Request ? Request : FastifyRequest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
next(); | ||
}; | ||
|
||
// const allFlagMiddleWare = <F extends keyof Flags>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
done: HookHandlerDoneFunction | ||
) => { | ||
const flagValue = abbyNodeInstance.getFeatureFlagValue(key as unknown as FlagName); //TODO fix type | ||
if (flagValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagValue
or !flagValue
?
if (flagValue) { | ||
reply.status(403); | ||
reply.send(); | ||
console.log("disbaled endpoint"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console
packages/nodejs/src/fastify/index.ts
Outdated
|
||
const setCookie = fastifyCookie; | ||
|
||
console.log(setCookie); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console
packages/nodejs/src/fastify/index.ts
Outdated
|
||
fastify.addHook("onRequest", (request, reply, done) => { | ||
ABTestHook(request, reply, done); | ||
// featureFlagHook("lol", request, reply, done); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
Adds possibility to use abby on serverside within any NodeJS enviroment