Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rahul_tripathi/galaxy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rahul_tripathi/galaxy

tiny api routing library for aws lambda

  • 1.0.0-pub
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

galaxy 💫

Galaxy is a tiny routing framework for Nodejs and AWS Lambda λ;

Installing Galaxy

 $ npm -i @rahul_tripathi/galaxy

Using Galaxy

  • Galaxy has three main route handlers (Galaxy , Stars , Moon) and Moon is the route handler which has the corresponding function
  • The resolve function takes the event object as the parameter and passes that event object to the corresponding handler function along with params if they are present
  • The params start with "$" and can be used any where

- creating a route path in galaxy

    let  galaxy  =  require('@rahul_tripathi/galaxy')
    let  apiRouter  =  galaxy.Galaxy('api') //initalize with /api endpoint
    handler = (x)=>{return x}
    let  testRouter  =  galaxy.Star('test1') // create an intermediate router 
    testRouter.append(galaxy.Moon('hello', handler ,'GET'))
    apiRouter.append(testRouter) 
    console.log(apiRouter.resolve({httpMethod :'GET',path:'/api/test1/hello'}))

- accepting params in galaxy

 let  galaxy  =  require('@rahul_tripathi/galaxy')
   let  apiRouter  =  galaxy.Galaxy('api') //initalize with /api endpoint
   handler = (x)=>{return x}
   apiRouter.append(galaxy.Moon('hello/$id/someother', handler,'GET')) //directly adding Moon to Galaxy is allowed 
   console.log(apiRouter.resolve({httpMethod  :  'GET',path  :'/api/hello/abc/mnop?abc=k'}))
   //This Outputs 
{
 httpMethod: 'GET',
 path: '/api/hello/abc/someother?abc=k',
 params: { id: 'abc' }
}

Keywords

FAQs

Package last updated on 17 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc