Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 764 Bytes

README.md

File metadata and controls

43 lines (31 loc) · 764 Bytes

Get your hands dirty

$ faas template pull https://github.com/maon-fp/node16-express-microservice
$ faas new --lang node16-express-microservice

Basic example

import { Router } from "express";

export default ({ app }) => {
  const router = Router();

  router.post("/", (request, response) => {
    return response.json({ message: "Hello world!", body: request.body });
  });

  return router;
};

Basic example with one external package that prints the time

yarn add moment
import { Router } from "express";
import moment from "moment";

export default ({ app }) => {
  const router = Router();

  router.get("/", (request, response) => {
    return response.json({ time: moment() });
  });

  return router;
};