Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

pn-retail-whitelisting-api

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
Package was removed
Sorry, it seems this package was removed from the registry

pn-retail-whitelisting-api

A backoffice api use to add users to retail whitelisting and manage permissions.

unpublished
latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

pn-retail-whitelisting-ui

  • Manage user access on Retail tools API

Build/deploy status

  • Build Status TEST

  • Build Status PROD

alt Overview

pn-retail-whitelisting-api

In this repo you will find code and resources that is used as a foundation in most of the software development team at TIQQE.

Visual Studio Code (OSX, Linux, Windows) is recommended as IDE

Prerequisites

  • nodejs (recommended version LTS at the time of writing: 14.17.2)
    Nodejs download

Project structure

serverless.yml

Everything in Serverless Framework starts in this file. Infrastructure components such as databases and queues, IAM rights, how a function is triggered, paths to APIs and how those APIs are protected and more can all be setup in this file.

resources/

To not flood the serverless.yml file with everything we add resources such as DynamoDB databases into the environment specific files under the resources directory.

env.yml

All environment params are located in this file and are loaded through the serverless.yml file.

provider
  environment: ${file(env.yml):${self:custom.stage}})

The environment params can then be accessed in the lambda functions like this:

// Load environment params into env.
const env = process.env;

src

All the code we write goes in here. Usually each new lambda function get a new directory.

Project Setup

  • run npm i in root of project. This will install all dependencies.

Running and debugging lambdas locally

npm start Will start a server on localhost:3000 that you can use like you would live. After running it you will see some output in the terminal similar to this:

Serverless: Watching for changes...
Serverless: Starting Offline: test/eu-west-1.

Serverless: Routes for ...:

Serverless: Offline [HTTP] listening on http://localhost:3000
Serverless: Enter "rp" to replay the last request

There is no need to run this command again as it will automatically update on changes in vscode. Press f5 and chose Debug to run local lambdas with debugger will also start the localhost:3000. Just like npm start.

Invoking functions

serverless invoke local -f <functionName> -p <path to event.json>

Testing

  • We use mocha and chai for testing
  • npm t will run all tests
  • To debug tests run the Debug Mocha Tests debug task in vscode.

Deploying serverless functions

When you push your code it will trigger a Build via CodeBuild in AWS.

If you want to deploy this project to your own AWS account you will first need to setup an AWS account can deploy it from your local machine. More info here:

More info:

FAQs

Package last updated on 12 Sep 2022

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