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

Request API #4

Closed
dhershman1 opened this issue Nov 30, 2018 · 1 comment
Closed

Request API #4

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

Comments

@dhershman1
Copy link
Owner

This is subject to change as the planning continues and grows

Related Issues

Description

The Request API would work a lot like Response does in the sense, it's job is to handle the request object and provide easy ways to work with the data.

It will be contained within the request module and usable like so:

const { parse } = require('octoris/request')

Now also like response parse won't be it's only function it's just the only one in planning atm. Each function will be granted it's own issue.

Usage

The below example is simply giving the status code to the function and then the data, as mentioned above this may or may not be a thing.

const { parse } = require('octoris/request')
const { send } = require('octoris/response')

const postHandler = ctx => {
  const data = parse(ctx.data)

  if (!data) {
    return send(500, 'No Data Provided')
  }

  return send(200, 'Data Saved!')
}
@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
@dhershman1
Copy link
Owner Author

Closing this for now, as a request API in itself may not be needed. Will re open once we can confirm what this should be doing.

Basics automation moved this from To do to Done Dec 17, 2018
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

1 participant