@chasten/whither-alpha

Part of Chasten.

Usage no npm install needed!

<script type="module">
  import chastenWhitherAlpha from 'https://cdn.skypack.dev/@chasten/whither-alpha';
</script>

README

whither-alpha

Part of Chasten.

whither-alpha is currently in alpha and makes no promises about API stability. It will eventually be superceded by whither (without the alpha), which will be a new project, a new NPMJS package, and a new git repository.

Installing / Getting started

To use whither-alpha you'll need the latest Node.js LTS version or newer and a Node.js package manager of your choosing. The examples all assume npm, but the alternatives work just as well.

Here's a snippet you can copy/paste into Bash to get a working example. You can safely run this in any empty directory.

npm init -y
npm install @chasten/whither-alpha

cat <<'EOF' >> example.js
const http = require('http');
const { requestListener } = require('@chasten/strait-alpha');
const handler = request => ({
  "body": JSON.stringify(request),
  "headers": { "content-type": "application/json" },
  "status": 200,
});
http.createServer(requestListener(handler)).listen(3000);
EOF

node example.js&
curl http://localhost:3000

You'll now have a new file called example.js, you'll have a running node process listening on port 3000, and you'll have sent a cURL request to see what your web service responds.

Developing

If you'd like to develop whither-alpha on your local machine you can get started pretty easily:

git clone https://gitlab.com/chasten/whither-alpha.git
cd whither-alpha/
npm ci

This will clone the repository from gitlab, change directory, and install the required development dependencies.

Deploying / Publishing

In order to publish new versions of whither-alpha you'll need public permissions for the organization on NPMJS and you'll need to be logged in with npm when you run the following command:

npm publish

This publishes a version (specified in the version field in package.json) to NPMJS.com.

Features

whither-alpha may work stand-alone as a routing library or in conjunction with strait-alpha to bind together routing with request handling. More to come.

Contributing

whither-alpha happily accepts contributions. Contributing to the project has a few requirements:

  • The rules outlined in CONTRIBUTING.md must be followed.
  • The ESLint style guide (@chasten/eslint-config) must be followed.

The latter should be set up in your editor/IDE of choice

Links

Licensing

The code in this project is licensed under MIT license.