
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
fusion-plugin-http-router
Advanced tools
Register and handle Http routes in a fusion app.
yarn add fusion-plugin-http-router
// src/main.js
import React from 'react';
import App from 'fusion-core';
import HttpRouter, {
HttpRouterToken,
HttpHandlersToken,
} from 'fusion-plugin-http-router';
// Define your http routes and methods server side
const handlers = __NODE__ && {
'/api': {
'/users': {
POST: async () => {
const user = createUser();
return user;
},
':id': {
GET: async ({params: {id}}, ctx) => {
return {some: 'data' + id};
},
PUT: async ({params: {id}, query, body}, ctx) => {
updateUser(body);
return {some: 'data' + id};
},
delete: async (args, ctx) => {
// Error Handling Example
try {
deleteUser();
} catch (e) {
const error = new Error('Failed to delete user');
error.code = 'DELETEUSER';
error.meta = {
custom: 'metadata',
};
throw error;
}
},
}
},
'/book': {...}
},
};
export default () => {
const app = new App(<div />);
if (__NODE__) {
app.register(HttpRouterToken, HttpRouter);
app.register(HttpHandlersToken, handlers);
}
return app;
};
HttpRouterimport HttpRouter from 'fusion-plugin-http-router'
The HttpRouter plugin. Registers http routes and handlers.
HttpRouterTokenimport { HttpRouterToken } from 'fusion-plugin-http-router'
The canonical token for the HttpRouter plugin. Typically, it should be registered with the HttpRouter plugin.
HttpHandlersTokenimport { HttpHandlersToken } from 'fusion-plugin-http-router'
Configures what http Router handlers exist. Required. Server-only.
type Args = {
params: Object,
query: Object,
body: Object,
files: Object
}
type HttpHandlers = {
[string]: { [string]: (args: Args, ctx: Context) => any },
}
You can register a value of type HttpHandlers.
BodyParserOptionsTokenimport { BodyParserOptionsToken } from 'fusion-plugin-http-router'
Configures the options for koa-body, internally used for parsing. Optional. Server-only.
FAQs
Registers http routes and handlers on the server.
We found that fusion-plugin-http-router 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.