Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@remix-run/node
Advanced tools
@remix-run/node is a package that provides utilities for building server-side applications with Remix. It includes tools for handling HTTP requests and responses, managing sessions, and working with cookies, among other things.
Handling HTTP Requests and Responses
This feature allows you to create a request handler for your Remix application. The `createRequestHandler` function sets up the necessary context for handling HTTP requests and responses.
const { createRequestHandler } = require('@remix-run/node');
const handler = createRequestHandler({
getLoadContext() {
return { some: 'context' };
}
});
module.exports = handler;
Managing Sessions
This feature provides a way to manage user sessions using cookies. The `createCookieSessionStorage` function sets up session storage with specified cookie options.
const { createCookieSessionStorage } = require('@remix-run/node');
const sessionStorage = createCookieSessionStorage({
cookie: {
name: '__session',
secrets: ['s3cr3t'],
secure: true,
sameSite: 'lax',
path: '/',
httpOnly: true
}
});
module.exports = sessionStorage;
Working with Cookies
This feature allows you to create and manage cookies. The `createCookie` function sets up a cookie with specified options like max age and HTTP-only flag.
const { createCookie } = require('@remix-run/node');
const myCookie = createCookie('myCookie', {
maxAge: 60 * 60 * 24,
httpOnly: true
});
module.exports = myCookie;
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. Unlike @remix-run/node, which is specifically designed for use with Remix, Express is a general-purpose framework that can be used for a wide variety of web applications.
Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. Koa uses async functions to help you write cleaner, more readable code. While @remix-run/node is tailored for Remix applications, Koa is a more general-purpose framework.
Hapi is a rich framework for building applications and services. It enables developers to focus on writing reusable application logic instead of spending time building infrastructure. Hapi is more configuration-driven compared to @remix-run/node, which is more convention-driven and integrated with Remix.
Remix is a web framework that helps you build better websites with React.
To get started, open a new shell and run:
npx create-remix@latest
Then follow the prompts you see in your terminal.
For more information about Remix, visit remix.run!
v2.11.0
Date: 2024-08-01
unstable_fogOfWar
future flag to unstable_lazyRouteDiscovery
(unstable)We found that the future.unstable_fogOfWar
flag name could be a bit confusing without the proper context (notably, the blog post), so we've renamed the flag to future.unstable_lazyRouteDiscovery
for clarity. If you had opted into this feature already, please update the name of the flag in your vite.config.ts
file (or remix.config.js
).
response
stub in Single Fetch (unstable)The original Single Fetch approach was based on an assumption that an eventual middleware
implementation would require something like the ResponseStub
API so users could mutate status
/headers
in middleware
before/after handlers as well as during handlers. As part of Single Fetch, we wanted to align how response headers would be merged between document and data requests. Thinking response
was the future API, we aligned document requests to use the response
stub that data requests were using, and we stopped using the headers()
function.
However, the realization/alignment between Michael and Ryan on the recent roadmap planning made us realize that the original assumption was incorrect. middleware
won't need a response
stub - as users can just mutate the Response
they get from await next()
directly.
Removing that assumption, and still wanting to align how headers get merged between document and data requests, it makes more sense to stick with the current headers()
API and align Single Fetch data requests to use that existing API. This was we don't need to introduce any new header-related APIs which will make the adoption of Single Fetch much easier.
With this change:
headers()
function will let you control header merging for both document and data requestsjson()
/defer()
without setting a custom status
or headers
, you can just remove those utility functions and return the raw data
return json({ data: "whatever" });
return { data: "whatever" };
status
or headers
via json
/defer
:
unstable_data
utility that will let you send back status
/headers
alongside your raw data without having to encode it into a Response
json
and defer
in the next major version, but both should still work in Single Fetch in v2 to allow for incremental adoption of the new behavior⚠️ If you've already adopted Single Fetch in it's unstable state and converted to response
stub, you'll need to move those changes back to leveraging the headers()
API.
@remix-run/dev
- Fog of War: Rename future.unstable_fogOfWar
to future.unstable_lazyRouteDiscovery
for clarity (#9763)@remix-run/server-runtime
- Add a new replace(url, init?)
alternative to redirect(url, init?)
that performs a history.replaceState
instead of a history.pushState
on client-side navigation redirects (#9764)@remix-run/server-runtime
- Single Fetch: Add a new unstable_data()
API as a replacement for json
/defer
when custom status
/headers
are needed (#9769)@remix-run/server-runtime
- Single Fetch: Remove responseStub
in favor of headers
(#9769)@remix-run/dev
- Handle absolute Vite base URLs (#9700)@remix-run/react
- Change initial hydration route mismatch from a URL check to a matches check to be resistant to URL inconsistencies (#9695)@remix-run/react
- Single Fetch: Ensure calls don't include any trailing slash from the pathname (i.e., /path/.data
) (#9792)@remix-run/react
- Single Fetch: Add undefined
to the useRouteLoaderData
type override (#9796)create-remix
@remix-run/architect
@remix-run/cloudflare
@remix-run/cloudflare-pages
@remix-run/cloudflare-workers
@remix-run/css-bundle
@remix-run/deno
@remix-run/dev
@remix-run/eslint-config
@remix-run/express
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/testing
Full Changelog: v2.10.3...v2.11.0
FAQs
Node.js platform abstractions for Remix
The npm package @remix-run/node receives a total of 707,018 weekly downloads. As such, @remix-run/node popularity was classified as popular.
We found that @remix-run/node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.