GithubHelp home page GithubHelp logo

Return about micro HOT 8 CLOSED

vercel avatar vercel commented on May 13, 2024
Return

from micro.

Comments (8)

rauchg avatar rauchg commented on May 13, 2024

@leo @kevin-roark @TooTallNate this is a cool one in case any of you wants to take it

from micro.

kevin-roark avatar kevin-roark commented on May 13, 2024

on it!

from micro.

kevin-roark avatar kevin-roark commented on May 13, 2024

I think it should be as simple as https://github.com/zeit/micro-core/pull/3

from micro.

joshbetz avatar joshbetz commented on May 13, 2024

Would it make sense to allow passing a response code? Maybe something like

return [201, 'Created']

from micro.

kevin-roark avatar kevin-roark commented on May 13, 2024

@joshbetz I think at that point it would be almost as simple to just call

send(res, 201, 'Created')

But I'm not totally opposed.

from micro.

luisrudge avatar luisrudge commented on May 13, 2024

I think there's great value in only returning a string or raw object. If you want to set the status code manually, use the send method. Default for raw string or object should be 200 OK

from micro.

rauchg avatar rauchg commented on May 13, 2024

[201, 'Created'] is technically a valid JSON response right? so, impossible to disambiguate…

from micro.

wprater avatar wprater commented on May 13, 2024

we can also return the request directly.

var request = require('request');
export default function () {
  return request('http://www.google.com');
}

which is nice, but if the request already finished and Im still returning the object its hung. Is this because the request's end method was already called?

from micro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.