Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Methods #5

Closed
13 tasks done
dhershman1 opened this issue Nov 30, 2018 · 2 comments
Closed
13 tasks done

HTTP Methods #5

dhershman1 opened this issue Nov 30, 2018 · 2 comments
Assignees
Labels
Proposal 💡 A feature or idea proposal Routing 📍 This label is related to a routing functionality
Projects

Comments

@dhershman1
Copy link
Owner

dhershman1 commented Nov 30, 2018

This is subject to change as the planning continues and grows

Related Issues

Tasks

  • Create supported HTTP Method Functions
    • Tweak these if we need each one to act just a little differently
  • Have methods support middleware (Possibly)
  • Improve flow based on above

Methods

The methods below have been implemented with basic functionality. I am unsure if much tweaking is needed for them to do anything "particular" at this point. However clean up is recommended as currently it is just the same function with different names, I also don't like how these are handled and written out. Should for sure revisit this soon.

  • CONNECT
  • DELETE
  • GET
  • HEAD
  • OPTIONS
  • PATCH
  • POST
  • PUT
  • TRACE

Description

The HTTP methods will be what kind of methods are allowed/able to be handled for a route They will come as functions that you will give your handler too, and then assigned to a route listener.

You can grab them from the methods module like so:

const { GET, POST } = require('octoris/modules')

You can use destructure to grab all of the methods you want/need

Usage

const { route, static } = require('octoris/router' 
const { GET, POST } = require('octoris/methods')

// Use them directly with the route array
route([static('about')], [
  GET(getHandler),
  POST(postHandler)
])
@dhershman1 dhershman1 added Proposal 💡 A feature or idea proposal Routing 📍 This label is related to a routing functionality labels Nov 30, 2018
@dhershman1 dhershman1 added this to the Basic Groundwork milestone Nov 30, 2018
@dhershman1 dhershman1 added this to To do in Basics via automation Nov 30, 2018
@dhershman1 dhershman1 mentioned this issue Nov 30, 2018
16 tasks
@Glen-Cocoa
Copy link
Collaborator

While they may be behaviorally the same, the second syntax reads much more clearly, as I know exactly what is in the array (functions!)

saving the function with its handler into a variable and then passing that in an array feels like a redundant step that also makes the code less readable

@dhershman1 dhershman1 moved this from To do to In progress in Basics Dec 27, 2018
@dhershman1 dhershman1 self-assigned this Jan 14, 2019
@dhershman1
Copy link
Owner Author

This has been finished up and all methods are accounted for in their current system

Basics automation moved this from In progress to Done Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal 💡 A feature or idea proposal Routing 📍 This label is related to a routing functionality
Projects
No open projects
Basics
  
Done
Development

No branches or pull requests

2 participants