Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

componium

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

componium

Componium Framework

  • 1.0.4
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ct // Componium - JavaScript full-stack framework

ct (componium) is a simple JavaScript testing full-stack framework

Features

Server

  • File-based and dynamic URL handling
  • GraphQL API server support
  • Ability to start multiple servers within the same context
  • Event API integrated with API routes.

Docs

  • Initialization
  • Server Configuration
  • Middleware
  • Routing
  • Client Views

Initialization

To begin, you'll need to initialize a new Componium application.

const app = await Componium.initialize();

Server Configuration

app.createServer(options)

const server = await app.createServer({
  name: "package-service",
  routesRootDir: "routes",
  port: 9000,
  gql: true, // Indicates GraphQL is enabled
});

Options:

  • name: Name of the server.
  • routesRootDir: The directory containing route definitions.
  • port: The port on which the server will listen.
  • gql: A boolean value to indicate if GraphQL is enabled.

Middleware

server.addMiddleware(name, callback)

Parameters:

  • name: A unique name for the middleware.
  • callback: A function to be executed as middleware.

Routing

const router = server.createRouter(path);

Parameters:

  • path: The URL path for the route.
  • callback: A function handling the request-response for this route.

router.addMiddleware(name, callback)

Client Views

Client Views create front-end application endpoints to server HTML, CSS, and JavaScript.

server.addClientView(path, viewName, config)

Parameters:

  • path: The URL path where the view will be accessible.
  • viewName: The name of the view, presumably used to locate the view template or component.
  • config: A configuration object with view-specific options.

License

MIT

FAQs

Package last updated on 24 Aug 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc