Skip to content

Add more advanced examples #19

Description

@ZPiDER666

The examples contained with pogo are very basic.

  • working with request objects should be demonstrated

  • working with path parameters should be demonstrated

    import pogo from 'https://deno.land/x/pogo/main.js';
    server.router.put('/path/{id}', async (request:pogo.Request) => {
        var id:String = request.route.params.id;	
    });
    
  • working with request body should be demonstrated

    import pogo from 'https://deno.land/x/pogo/main.js';
    import { bodyReader } from "https://deno.land/std/http/io.ts";
    server.router.put('/path', async (request:pogo.Request) => {
        const reader = bodyReader(request.raw.contentLength, request.raw.r);
        const bufferContent = await Deno.readAll(reader);
        const bodyText = new TextDecoder().decode(bufferContent);
        const body = JSON.parse(bodyText);	
    });
    
  • etc. (file upload, headers, content types, ..)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedExtra attention is neededhousekeepingCleanup and paying beck technical debt

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions