Test your plugin locally
- Install deno
- Within the folder you created for your pluginCreate your own plugin1. Fork this repository
1. Create a folder to plugins/community in your fork. Use dashes to seperate words when naming this folder.
1. In the folder you created, add a file index.ts
1. Create a function within index.ts to that takes in the Request as a parameter and returns a Response. For example:
export default (request: Request) : Response => {
var exampleNote = {
"note": {
"title": "new title"
"content": "new content",
"source": "new source",
}
}
return new R, create a file called
webserver.ts
and add the following lines to it.
import { serve } from "https://deno.land/[email protected]/http/server.ts";
import myPlugin from "./index.ts"
serve(myPlugin);
- Now run the deno command to start the webserver
deno run --allow-all webserver.ts
- Once the webserver is up and running go to http://localhost:8000 to call the function you created in
index.ts
- Here is an example curl request to get you started
curl -d '{"metadata":"some metadata", "note":{"title":"title","content":"content","source":"source"}}' -H "Content-Type: application/json" -X POST http://localhost:8000/
See plugins/community/example as an example