Skip to content

AamirAlam/eth-istambul-service

Repository files navigation

SleepSwap offchain service

Build Status

SleepSwap offchain service to invoke airnode to start picking up orders from strategy on chain .

This repo is functionality complete — PRs and issues welcome!

Getting started

To get the Node server running locally:

  • Clone this repo
  • npm install to install all required dependencies
  • Place the required env variables defined in example.env
  • npm run dev to start the local server

Code Overview

Dependencies

  • expressjs - The server for handling and routing HTTP requests
  • express-jwt - Middleware for validating JWTs for authentication
  • jsonwebtoken - For generating JWTs used by authentication
  • mongoose - For modeling and mapping MongoDB data to javascript
  • mongoose-unique-validator - For handling unique validation errors in Mongoose. Mongoose only handles validation at the document level, so a unique index across a collection will throw an exception at the driver level. The mongoose-unique-validator plugin helps us by formatting the error like a normal mongoose ValidationError.
  • passport - For handling user authentication
  • slug - For encoding titles into a URL-friendly format

Application Structure

  • server.js - The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application.
  • services/ - This folder contains all the services needed to make airnode trx
  • routes/ - This folder contains the route definitions for our API.

Releases

No releases published

Packages

No packages published