0.2.6 • Published 5 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.ts
or implementsrc/Action/ActionInterface.ts
- Put the
src/Decorator/Route.ts
decoration 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/Route
as 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
5 years ago
0.2.4
5 years ago
0.2.3
5 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago