Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
chore(refactor): move project files in to src directory (#91)
Browse files Browse the repository at this point in the history
* chore(refactor): move project files in to src directory

* chore(refactor): integration tests can stay in the root

* chore: disable max-len for comment with URL
  • Loading branch information
ojongerius authored and Bouncey committed May 1, 2018
1 parent b6ded55 commit dc7f111
Show file tree
Hide file tree
Showing 23 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ provider:
stage: dev
region: us-east-1
environment:
GRAPHQL_ENDPOINT_URL: ${file(./config/secrets.js):getSecret.GRAPHQL_ENDPOINT_URL}
JWT_CERT: ${file(./config/secrets.js):getSecret.JWT_CERT}
MONGODB_URL: ${file(./config/secrets.js):getSecret.MONGODB_URL}
GRAPHQL_ENDPOINT_URL: ${file(./src/config/secrets.js):getSecret.GRAPHQL_ENDPOINT_URL}
JWT_CERT: ${file(./src/config/secrets.js):getSecret.JWT_CERT}
MONGODB_URL: ${file(./src/config/secrets.js):getSecret.MONGODB_URL}
iamRoleStatements:
- Effect: Allow
Action:
Expand All @@ -31,15 +31,15 @@ custom:

functions:
graphql:
handler: handler.graphqlHandler
handler: src/handler.graphqlHandler
events:
- http:
path: graphql
method: post
cors: true

api:
handler: handler.apiHandler
handler: src/handler.apiHandler
events:
- http:
path: api
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion auth/index.js → src/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function verifyWebToken(ctx) {
let decoded = null;
let error = null;
try {
decoded = jwt.verify(token.replace('Bearer ', ''), JWT_CERT);
decoded = jwt.verify(token.replace('Bearer ', ''), JWT_CERT);
} catch (err) {
error = err;
} finally {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions handler.js → src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ exports.graphqlHandler = async function graphqlHandler(
context,
callback
) {
/* eslint-disable max-len */
/* Cause Lambda to freeze the process and save state data after
the callback is called. the effect is that new handler invocations
will be able to re-use the database connection.
See https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
and https://www.mongodb.com/blog/post/optimizing-aws-lambda-performance-with-mongodb-atlas-and-nodejs */
/* eslint-enable max-len */
context.callbackWaitsForEmptyEventLoop = false;

function callbackFilter(error, output) {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/integration/users.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* global beforeAll afterAll expect */
import { graphqlSchema } from '../../handler';
import { graphqlSchema } from '../../src/handler';

const mongoose = require('mongoose');
const { graphql } = require('graphql');
const UserModel = require('../../dataLayer/model/user.js');
const UserModel = require('../../src/dataLayer/model/user.js');

beforeAll(async function beforeAllTests() {
await mongoose.connect(global.__MONGO_URI__);
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path');
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');

const include = './_webpack/include.js';
const include = './src/_webpack/include.js';
const entries = {};

Object.keys(slsw.lib.entries).forEach(
Expand Down

0 comments on commit dc7f111

Please sign in to comment.