0.2.6 • Published 7 years ago
@secretary/now-node-framework v0.2.6
Now Framework for NodeJS
Need to update these
Usage
- Create actions that extend
src/Action/AbstractAction.tsor implementsrc/Action/ActionInterface.ts - Put the
src/Decorator/Route.tsdecoration on your actions. - Run
./node_modules/.bin/buildNowJson path/to/my/actions- For monolithic apps, have this installed in the sub-repo, and run
./api/node_modules/.bin/buildNowJson api/src/Routeas an example
- For monolithic apps, have this installed in the sub-repo, and run
Ideally, you'd be able to just add something to your now config, but until they support now.js, that wont be possible
example
// api/src/Route/HelloAction.ts
import {AbstractAction, Route} from '@secretary/now-node-framework';
@Route('/api/hello/(.*)', '?name=$1')
export default class HelloAction extends AbstractAction {
public invoke(): Promise<void> {
return this.send('Hello ' + this.request.query.name);
}
}And then this gets auto-generated
{
"name": "monorepo",
"version": 2,
"builds": [
{
"src": "www/package.json",
"use": "@now/next"
},
{
"src": "api/src/Action/HelloAction.ts",
"use": "@now/node"
}
],
"routes": [
{
"src": "/api/hello/(.*)",
"dest": "/api/src/Action/HelloAction.ts?name=$1"
},
{
"src": "/(.*)",
"dest": "/www/$1",
"headers": {
"x-request-path": "$1"
}
}
]
}0.2.6
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago