Skip to content

Instantly share code, notes, and snippets.

View Mcdavid95's full-sized avatar
🥘
Really always hungry

Mcdavid Emereuwa Mcdavid95

🥘
Really always hungry
  • emax digital
  • Lagos, Nigeria
View GitHub Profile
{
firstname: {
type: string,
access:[
{ usertype: 1, range: 'none', accessType: 2 },
{ usertype: 4, range: 'none', accessType: 2 },
{ usertype: 5, range: 'any', accessType: 3 },
{ usertype: 9, range: 'any', accessType: 4 },
{ usertype: 10, range: 'any', accessType: 4 } //
]
const express = require('express');
const bodyParser = require('body-parser');
// Our function which adds two numbers and returns the result
const addNumbers = (firstNumber, secondNumber) => {
// check that input is a number
if (typeof(Number(firstNumber)) !== 'number' || typeof(Number(secondNumber)) !== 'number') {
return 'Values should be integer or numbers'
}
return Number(firstNumber) + Number(secondNumber);
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
{
"scripts": {
"start": "node index.js"
}
}
const supertest = require('supertest');
const server = require('./index');
const chai = require('chai');
chai.should();
const api = supertest.agent(server);
describe('Add method', () => {
it('should connect to the Server', (done) => {
# Node docker image on which this would be run
image: node:8.10.0
cache:
paths:
- node_modules/
stages:
- test
- deploy_production
@Mcdavid95
Mcdavid95 / index-0.js
Created February 24, 2020 20:45
SES RabbitMQ Tutorial
const express = require('express');
const { json, urlencoded } = express;
const app = express();
app.use(json());
app.use(urlencoded({ extended: true }));
app.get('/', (req, res) => {
return res.status(200).send({
message: 'Welcome to our API'
@Mcdavid95
Mcdavid95 / index-0.js
Created February 24, 2020 20:45
SES RabbitMQ Tutorial
const express = require('express');
const { json, urlencoded } = express;
const app = express();
app.use(json());
app.use(urlencoded({ extended: true }));
app.get('/', (req, res) => {
return res.status(200).send({
message: 'Welcome to our API'
@Mcdavid95
Mcdavid95 / .env
Last active February 26, 2020 22:36
SES RabbitMQ Tutorial
AWS_ACCESS_KEY_ID='YOUR_AWS_ID'
AWS_SECRET_ACCESS_KEY='YOUR_AWS_SECRET_KEY'
@Mcdavid95
Mcdavid95 / awsConfig.js
Created February 27, 2020 10:03
SES RabbitMQ Tutorial
const AWS = require('aws-sdk');
const dotenv = require('dotenv');
dotenv.config();
AWS.config.update({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
});