Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and improvements prior to MVP experiments coding #58

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
PORT=3000

# URL of the Mongo DB
MONGODB_URL=mongodb://127.0.0.1:27017/node-boilerplate
MONGODB_URL=mongodb://127.0.0.1:27017/nymspace
# Output debug information from mongoose?
MONGODB_DEBUG=false

# JWT
# JWT secret key
Expand All @@ -22,4 +24,4 @@ SMTP_PASSWORD=email-server-password
[email protected]

# This is used to build links for the reset password and channel archive emails
APP_HOST=http://localhost:3000
APP_HOST=http://localhost:3000
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
bin
node_modules/
bin/
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
env: {
node: true,
jest: true
},
extends: [
'standard',
'airbnb-base',
'plugin:jest/recommended',
'plugin:security/recommended',
'plugin:prettier/recommended'
],
plugins: ['jest', 'security', 'prettier'],
rules: {
'no-console': 'error',
'func-names': 'off',
'no-underscore-dangle': 'off',
'consistent-return': 'off',
'jest/expect-expect': 'off',
'security/detect-object-injection': 'off'
}
}
19 changes: 0 additions & 19 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn lint-staged
# TODO: enable after this task is complete! yarn audit:critical
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"singleQuote": true,
"trailingComma": "none",
"tabWidth": 2,
"semi": false,
"printWidth": 125
}
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Description

This is the backend API for [berkmancenter/threads_client](https://github.com/berkmancenter/threads_client).
This is the backend API for [berkmancenter/nymspace_client](https://github.com/berkmancenter/nymspace_client).

## Installation

Expand Down Expand Up @@ -34,17 +34,21 @@ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build

## Running locally

1. Start by copying `.env.example` to `.env`.
1. Start by copying `.env.example` to `.env.local`.
2. Install `mongodb`
3. Run MongoDB with `mongod`
4. Install all dependencies with `npm install`.
5. Run `npm run dev` to serve the API locally.
4. Install `node.js` and set to version specified in `package.json` file (Consider using [nvm](https://github.com/nvm-sh/nvm))
5. Install [yarn](https://classic.yarnpkg.com/lang/en/docs/install)
6. Install all dependencies with `yarn install`.
7. Run `yarn run dev` to serve the API locally.

## Tests

### Unit and integration tests

Unit and integration tests can be run with `npm run test`, and a coverage report can be seen with `npm run coverage`.
Unit and integration tests can be run with `yarn run test`, and a coverage report can be seen with `yarn run coverage`.

Note that the tests use the `.env` file instead of `.env.local`. Copy `.env.local` to `.env` for local running tests in local development environment.

### Stress tests

Expand All @@ -54,4 +58,4 @@ Stress tests can be run from the client repo in the [k6 directory](https://githu

1. Pull the latest code from Github (currently the dev branch)
2. Configure .env and install dependencies
3. Run `npm run start` to serve the API with [PM2](https://pm2.keymetrics.io/docs/usage/process-management/)
3. Run `yarn run start` to serve the API with [PM2](https://pm2.keymetrics.io/docs/usage/process-management/)
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
testEnvironment: 'node',
testEnvironmentOptions: {
NODE_ENV: 'test',
NODE_ENV: 'test'
},
restoreMocks: true,
coveragePathIgnorePatterns: ['node_modules', 'src/config', 'src/app.js', 'tests'],
coverageReporters: ['text', 'lcov', 'clover', 'html'],
};
coverageReporters: ['text', 'lcov', 'clover', 'html']
}
Loading