Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Outline

Make a JavaScript function a service with fx

Write a function like,

module.exports = (ctx) => {
  ctx.body = 'hello world'
}

then deploy it with fx up command,

$ fx up -p 8080 func.js

test it using curl

$ curl 127.0.0.1:8080

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Date: Tue, 06 Aug 2019 15:58:41 GMT

hello world

ctx

The ctx object is exactly the ctx of Koa

Morty Proxy This is a proxified and sanitized view of the page, visit original site.