@micburks/serve

serve arbitrary script output

Usage no npm install needed!

<script type="module">
  import micburksServe from 'https://cdn.skypack.dev/@micburks/serve';
</script>

README

serve

Serve arbitrary script output

Usage

npx @micburks/serve script.js
// script.js
console.log(`
  <div>
    <h1>Hello world!</h1>
  </div>
`);

Using modules

serve requires Node 12 and runs your script equivalent to

node --experimental-modules --loader @micburks/jspm-loader script.js
// script.js
import fetch from 'https://dev.jspm.io/whatwg-fetch';
import greet from './greet.js';

(async () => {
  const data = await fetch('/user')
    .then(res => res.json());

  console.log(`
    <div>
      <h1>${greet(data.name)}</h1>
    </div>
  `);
})();