local-runner
v0.1.1-alpha
Published
A local runner for projects built to run on AWS Lambda and be deployed by the BlinkMobile Server CLI.
Downloads
1,727
Readme
Local Runner
A local runner for API projects to be deployed using the Server CLI.
Instructions
Install the package:
npm install --save-dev local-runner
Put a file in the root of your project - ie. one level above your endpoints -eg. Assuming that you have a directory structure like this:
my-project/
├── v1/
│ ├── helloworld/
│ ├── index.js
│ ├── hellogalaxy/
│ ├── index.js
You would have a .blinkmrc.json
file with these routes:
{
"server": {
...
"routes": [
{
"route": "/v1/helloworld",
"module": "./v1/helloworld/index.js"
},
{
"route": "/v1/hellogalaxy",
"module": "./v1/hellogalaxy/index.js"
}
]
}
}
Put a file called runner.js
in the root of your project (my-project
in the example above) with this code in it:
require('local-runner')()
Running node runner.js
will start a server on http://localhost:8000. Your endpoints will be accessible at:
- http://localhost:8000/v1/helloworld
- http://localhost:8000/v1/hellouniverse
Visual Studio Code
An example .vscode/launch.json
file for debugging in VSCode:
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/runner.js"
}
]
}