1.1.8 • Published 2 years ago

capy-wf v1.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

cwf

wakatime

The WIP web framework created to be used by j4ce.

Currently TypeScript only!

Setup Guide

  • Create an npm project.
  • Setup the folders more or less like this
📦The Main Folder
 ┣ 📂components
 ┃ ┗ 📜Xyz.cwf
 ┣ 📂src
 ┃ ┗ 📜index.ts
 ┣ 📂views
 ┃ ┣ 📂api
 ┃ ┃ ┗ 📜test.ts
 ┃ ┗ 📜index.cwf
 ┣ 📜package-lock.json
 ┗ 📜package.json
  • The index.ts file should look like this
import { cwf } from 'capy-wf';

const app = cwf({
  debug: true,
});

app.listen();
  • Install ts-node-dev npm i --save-dev ts-node-dev
  • Add a dev script to the package.json file "dev": "ts-node-dev ./src/index.ts"
  • Run it! npm run dev

Api Example

Put the file in views/api/{apiName}.ts

Should look like this:

import { ApiContext } from 'capy-wf';

export default async function (ctx: ApiContext) {
  console.log(`Got: ${ctx.method}`);

  ctx.sendJson({
    hello: 'world',
  });
}
1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago