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
Clarification needed on hattip-entry file #111
Comments
Hi, Thank you for your interest! See the session example in the repo, it should give you the direction in which to start. The import { createRequestHandler } from "rakkasjs";
export default createRequestHandler(); The docs show all the options you can pass to import { createRequestHandler } from "rakkasjs";
import { cookie } from "@hattip/cookie";
import { session, SimpleCookieStore } from "@hattip/session";
// Declare session data type
declare module "@hattip/session" {
interface SessionData {
foo: string;
bar: number;
}
}
export default createRequestHandler({
middleware: {
beforePages: [
cookie(),
session({
store: new SimpleCookieStore(),
defaultSessionData: { foo: "xyz", bar: 42 },
cookieOptions: {
httpOnly: true,
secure: import.meta.env.PROD,
path: "/",
maxAge: 60 * 60 * 1000, // 1 week
},
}),
],
},
}); I know how frustrating it can be when the documentation isn't great, feel free to ping me on Rakkas Discord channel or my Twitter DMs for quick questions on getting started. |
Hello @cyco130, thanks so much for taking the time to reply and to reply so extensively. I have replaced my implementation with an adjusted version of your example, and the application is now working 😊 |
Reopened because I think this part from your answer might help others, too, if it was taken into the documentation:
|
Yes, let's leave it open. It'll serve as a reminder for me to update the docs :) |
I am trying to add cookie / session support to my rakkasjs project.
The docs give some instructions on how this might be achieved, but I am still unsure if I am doing it right.
I think it would be helpful to clarify the following points in the documentation:
I am new to both rakkasjs and hattip and find this part very confusing.
The text was updated successfully, but these errors were encountered: