eco-rewards-hub

Eco Rewards Hub

Eco Rewards Hub

API to ingest and process passenger travel transactions and calculate eco rewards.

Installation

Node +12 and a MySQL compatible database are required. The Ubuntu set up is:

curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs mariadb-server
# warning this will blank your root mysql password
sudo mysql -u root mysql -e "update user set authentication_string=password(''), plugin='mysql_native_password' where user='root'; flush privileges;"

Installing and running the service:

git clone git@github.com:EcoRewards/eco-rewards-hub.git
npm install --save eco-rewards-hub
npm run migrate
npm start

CLI commands

There are some CLI commands to help get set up:

npm run cli -- create-scheme [name]
npm run cli -- create-organisation [name] [schemeId]
npm run cli -- create-group [name] [organisationId]
npm run cli -- create-user [name] [email] [password] [role]
npm run cli -- export-all-members

Functional requirements

The scope of the API is defined by a number of user stories in cucumber format.

See features.

Non-functional requirements

  • Swagger documentation
  • Secure API access
  • Continuous integration with automated tests

Decision log

DateDecisionReasoning
2019-11-01Implement with node.jsDevelopers familiar with it, fast iteration speed
2019-11-01Use a MySQL compatible databaseDevelopers familiar with it, widely used
2019-11-01Use AWSIt's convenient and widely used
2019-11-18Do not use dockerUnnecessary for a project this size
2019-11-18Make the code open-sourceNo need for private repository, cheaper tooling (Travis et al)
2019-11-18Use travis CIIt's free
2019-11-18Use cucumber to capture functional requirementsTrack the evolution of requirements and use as a basis for functional tests
2019-11-18Use use KoaWidely used and supports promises
2019-11-18Use db-migrateMost widely used database migration tool
2019-11-18Do not use an ORMSeems like overkill when there are so few models
2019-11-18Bcrypt passwordsMost secure, widely used method to salt passwords
2019-11-19Basic auth for API accessSimple, widely used and easy to implement
2019-11-21Swagger documentationComes with a slick UI and package to validate requests and responses
2019-11-21Link based API responsesReduces duplication in API responses. See this post
2019-11-27Travis deploymentSimple, easy, as seen here
2019-11-27PM2 process managementMakes the travis deployment easier

License

This software is licensed under GNU GPLv3.

Repository

https+https://github.com/ecorewards/eco-rewards-hub


上一篇:cucumber-pretty
下一篇:前端API层架构,也许你做得还不够

相关推荐

  • 黄金搭档 -- JS 装饰器(Decorator)与Node.js路由

    很多面对象语言中都有装饰器(Decorator)函数的概念,Javascript语言的ES7标准中也提及了Decorator,个人认为装饰器是和一样让人兴奋的的变化。

    1 年前
  • 高效阅读Github源代码

    三种办法。如果你主要看前端项目的代码,直接看第三种。 1,用Chrome插件Octotree,左侧会出现树形结构,方便你浏览源代码。 (https://img.javascriptcn.com/6...

    2 年前
  • 链接和执行外部JavaScript文件托管在GitHub上

    AuthorProxy(https://stackoverflow.com/users/1763061/authorproxy)提出了一个问题:Link and execute external Ja...

    2 年前
  • 详解JavaScript中setSeconds()方法的使用

    javascript Date.setSeconds()方法按照本地时间的设置秒指定日期。 语法 注:括号内外的数据是可选的 下面是参数的详细信息: secondsV...

    3 年前
  • 详解 Github App 的玩法

    image(https://img.javascriptcn.com/8ee2bda1b962f5c4f8ece5c07608382e "image") 之前在使用 Github issues 搭建...

    1 年前
  • 解决Node.js使用MySQL出现connect ECONNREFUSED 127.0.0.1:3306的问题

    前言 最近用 Node 写一个小玩意,需要用到 MySQL 数据库,现在用得最广泛的是 mysql 这个库。然后呢,现在 ORM 这么火,干脆也上 ORM 吧,正好我也不会可以学习一下,于是找到...

    3 年前
  • 装饰器@decorator

    简介 其他语言中一直有装饰器的概念,但是知道ES6才被引入到js中。当ES6引入了类的概念之后,我们在多个类之间共享或者扩展一些方法就变得有些不友好,也不优雅,所以才会引入装饰器的概念。

    2 年前
  • 聊聊Typescript中的设计模式——装饰器篇(decorators)

    随着Typescript的普及,在KOA2和nestjs等nodejs框架中经常看到类似于java spring中注解的写法。本文从装饰模式出发,聊聊Typescipt中的装饰器和注解。

    1 年前
  • 简介JavaScript中的getSeconds()方法的使用

    javascript Date.getSeconds()方法按照本地时间在指定日期返回秒。通过getSeconds返回的值是0到59之间的一个整数。 语法 下面是参数的详细信息: ...

    3 年前
  • 简介JavaScript中setUTCSeconds()方法的使用

    javascript Date.setUTCSeconds()方法按照通用时间设置秒指定日期。 语法 注:括号内外的数据是可选的 下面是参数的详细信息: second...

    3 年前

官方社区

扫码加入 JavaScript 社区