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

eo-services-functions-sls

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eo-services-functions-sls

EO Web Services as Serverless functions

  • 0.4.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Serverless Functions (FaaS) for EO API

In this repo you'll find the backend functions for web (micro) services.

Currently available 'services':

  • services/content-hub : Contains micro services to communicate with headless CMS / Content HUB

    • /articles [GET] all, by Id, by slug , by environment --> items:[]
    • /forms/:id [GET] by Id --> item:{}
    • /pages [GET] all, by Id, by slug --> items:[]
    • /persons [GET] all, by Id, by slug --> items:[]
    • /pressreleases [GET] all, by Id, by slug --> items:[]

    Filters (url params):

    • domain
    • limit
    • offset
    • textsearch

    Related

    • /persons/:presenterId/pressreleases?personType=contact|presenter
  • services/contact : Microservice for contact by email

    • /mailform [POST] form --> formData:{}
  • services/poms : Microservice for Poms data

    • /poms/:mid [GET] by Mid --> item:{}

How to install locally

Please make sure to have following dependencies installed locally:

  • Node 10.x ($ nvm use)
  • Serverless Framework ($ npm i serverless -g)
  • Azure CLI ($ brew update && brew install azure-cli)
  • Install the CLI for EO's "Veilige Opslag": Veilige Opslag

Before you begin

... install npm packages (make sure you have set env var NPM_TOKEN that corresponds with NPM Org eo): $ npm i

Local development

Decrypt and copy the .env-file from EO's "Veilige Opslag":

$ veilige-opslag fetch -elus api

To run a Serverless API server locally (offline), run this in root folder:

$ npm run dev This will create local folders and fire up a webserver at http://0.0.0.0:7071. Find local endpoints in Terminal logs Http Functions:. When server has started, you can make API calls to localhost. Event data will be outputted to terminal.

Invoke function (locally)

Status:

  • Invoke function currently doesn't work due to Webpack hooks
  • Looks up functions in file serverless.yml at root
$ sls invoke local -f {functionName}

Deploy to Azure

  1. Make sure you're not logged in with Azure in your shell $ az logout

  2. Easily activate Azure service principal by loading the appropriate environment variables using EO's CLI for "Veilige Opslag":

    $ source ./loadenv.sh
    
  3. To deploy to (default) dev stage, run: $ sls deploy

  4. Make sure to add the environment variables as "Application settings" in Azure Function App. https://docs.microsoft.com/bs-latn-ba/azure/azure-functions/functions-how-to-use-azure-function-app-settings

Serverless (Azure) documentation

OpenAPI 3.0 driven documentation

1. Writing documentation

We've adopted (a clone of) the serverless-openapi-documentation plugin to document our API. This makes it possible to maintain our documentation right within our serverless.yml. As close to the code as possible!

Please refer to the [https://www.serverless.com/plugins/serverless-openapi-documentation/ ](Serverless OpenAPI Documentation) to write your docs.

2. Generate the OpenAPI Specification

Just use the following command to generate the specification:

$ serverless openapi generate

3. Viewing documentation

We import the resulting OpenAPI specification in our SwaggerHub: https://app.swaggerhub.com/apis-docs/EO-Studio-Digitaal/eo-api/1 (credentials reside in our LastPass account).

Improvements

  • implement Serverless @multicloud library (platform agnostic sls app)
  • invoke functions locally

Development Urls

##ARTICLES ###=list= http://localhost:7071/api/articles

##PAGES ###=list= http://localhost:7071/api/pages

##PRESSRELEASES ###=list= http://localhost:7071/api/pressreleases http://localhost:7071/api/pressreleases?offset=0&limit=2 http://localhost:7071/api/pressreleases?offset=0&limit=20&domain=corporate-eo-staging ###=textsearch= http://localhost:7071/api/pressreleases?offset=0&limit=20&domain=corporate-eo-staging&textsearch=Anne%20Frank ###=get by id= http://localhost:7071/api/pressreleases/65dee676-6852-4f6c-8e38-166b35f83ac4 ###=get by slug= http://localhost:7071/api/pressreleases?slug=het-is-weer-tijd-voor-een-nieuwe-naam-voor-de-afdeling-die-internet-dingen-doet

##PERSONS ###=list= http://localhost:7071/api/persons ###=get by slug= http://localhost:7071/api/persons?slug=deborah-van-geest ###=get by id= http://localhost:7071/api/persons/6eefb87b-4854-4866-9ace-d46bbc501e06 ###=textsearch= http://localhost:7071/api/persons?textsearch=knevel ###=nested= http://localhost:7071/api/persons/:personId/pressreleases?personType=contact|presenter http://localhost:7071/api/persons/6eefb87b-4854-4866-9ace-d46bbc501e06/pressreleases?personType=contact http://localhost:7071/api/persons/ec8dc644-505f-487d-af76-511489b1c547/pressreleases?personType=presenter http://localhost:7071/api/persons/ec8dc644-505f-487d-af76-511489b1c547/pressreleases -> not implemented

FAQs

Package last updated on 14 May 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