Releasing @clarityhub/serverless-simple-router

What’s It For?

Usage

service: example
provider:
name: aws
runtime: nodejs12.x
functions:
root:
handler: src/router.default
events:
- http:
path: /
method: any
cors: true
- http:
path: /{proxy+}
method: any
cors: true
import { Router, RouteBuilder } from '@clarityhub/serverless-simple-router';
import TaskController from './controllers/TaskController';

const middyMiddleware = [httpHeaderNormalizer(), cors(), bodyParser()];
routes.resource('/tasks', RouteBuilder.crud(TaskController, middyMiddleware));

export default routes.exec();
  • GET /tasks routes to TaskController.getAll
  • GET /tasks/:id routes to TaskController.get
  • POST /tasks routes to TaskController.create
  • PUT /tasks routes to TaskController.update
  • DELETE /tasks routes to TaskController.delete

Going Further

Check It Out

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ivan Montiel

Ivan Montiel

UI Engineer at Lacework. Founder at Clarity Hub.