webcs
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-dev.2 • Public • Published

Web compile service

Express route that exposes an end-point for serving source files to the browser in development. Files are compiled by webpack, but they don't need to be statically declared in webpack.config.js. All source files can be served on demand.

Installation

npm i webcs

Usage

import path from "path";
import express from "express";
import expressWs from "express-ws";
import { makeCsRoute } from "webcs";

// make the middleware

const { webcsRoute } = makeCsRoute({
  compileServiceRoot: __dirname,
  webRootUrl: "http://localhost:3000",
  webcsMountPath: "webcs",
  staticWebFolder: "probably just for javi",
});

// make the express app

const app = express();

expressWs(app);

app.use("webcs", webcsRoute());

app.listen(3000);

// now a file `hello.ts` is servered ready for the browser at:
// http://localhost:3000/webcs/hello.ts

Known issues

License

MIT

Package Sidebar

Install

npm i webcs

Weekly Downloads

0

Version

0.0.0-dev.2

License

MIT

Unpacked Size

8.58 kB

Total Files

11

Last publish

Collaborators

  • jawis