
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
pico-di-remix-express
Advanced tools
_ _ _
_ __ (_) ___ ___ __| (_)
| '_ \| |/ __/ _ \ _____ / _` | |
| |_) | | (_| (_) |_____| (_| | |
| .__/|_|\___\___/ \__,_|_| + Remix + express
|_|
Adapter for using pico-di
with Remix + express.
pico-di
を Remix + express 環境で使うためのアダプタです。
pico-di-remix-express
には pico-di
に加えて以下の機能があります:
Remix + express (@remix-run/express
) に対応しています。
Node.js
npm から入手できます。インストールするには:
$ npm install pico-di-remix-express
サービスは全て ~/services
ディレクトリ以下にまとめ、~/services/index.ts
でそれぞれインポートします。プロバイダ作成関数をエクスポートする必要があります。
// /app/services/index.ts
import { createGetProvider } from "pico-di-remix-express";
import Service1 from "./Service1";
import Service2 from "./Service2";
import Service3 from "./Service3";
type Context = {
service1: Service1,
service2: Service2,
service3: Service3,
};
// `getProvider` という名前にしておきます。
const getProvider = createGetProvider<Context>(builder => builder
.addSingleton("service1", Service1)
.addScoped("service2", Service2)
.addTransient("service3", Service3));
export {
getProvider,
type Context,
type Service1,
type Service2,
type Service3,
}
/app/entry.server.tsx
の修正先ほどの getProvider
という関数を ~/entry.server.tsx
からエクスポートする必要があります。このエクスポートは pico-di-remix-express
がサービスプロバイダを取得するために必要です。
// /app/entry.server.tsx
export { getProvider } from "~/services";
// ...
/server.js
の修正import { type LoaderArgs, type ActionArgs } from "pico-di-remix-express";
import { type Context } from "~/services";
export const loader = ({
context: {
service1,
service2,
service3,
},
}: LoaderArgs<Context>) => {
// ...
};
export const action = ({
context: {
service1,
service2,
service3,
},
}: ActionArgs<Context>) => {
// ...
};
FAQs
Adapter for using pico-di with Remix + express.
The npm package pico-di-remix-express receives a total of 0 weekly downloads. As such, pico-di-remix-express popularity was classified as not popular.
We found that pico-di-remix-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.