Permalink
Browse files

Refactor server files back to top level

Having everything under server was annoying, especially with the
split-up of the server file into modules.

To prevent sprawl at the top level, still group things under a modules folder.
  • Loading branch information...
lovett committed May 10, 2017
1 parent 62327f9 commit 53bf93f374c55cfb83575e397f57b93f59306335
Showing with 44 additions and 46 deletions.
  1. +1 −1 Gruntfile.js
  2. +1 −1 README.md
  3. +1 −1 ansible/templates/notifer.service.j2
  4. +1 −2 build.sh
  5. 0 {server → }/config-test.json
  6. +5 −5 hooks/pre-commit
  7. 0 {server → modules}/auth/basic.js
  8. 0 {server → modules}/auth/local.js
  9. 0 {server → modules}/helpers/create-user.js
  10. 0 {server → modules}/helpers/publish-message.js
  11. 0 {server → modules}/helpers/verify-subscription.js
  12. 0 {server → modules}/middleware/asset.js
  13. 0 {server → modules}/middleware/favicon.js
  14. 0 {server → modules}/middleware/logger.js
  15. 0 {server → modules}/middleware/security.js
  16. 0 {server → modules}/models/Message.js
  17. 0 {server → modules}/models/Token.js
  18. 0 {server → modules}/models/User.js
  19. 0 {server → modules}/routes/archive.js
  20. 0 {server → modules}/routes/auth.js
  21. 0 {server → modules}/routes/deauth.js
  22. 0 {server → modules}/routes/index.js
  23. 0 {server → modules}/routes/message/clear.js
  24. 0 {server → modules}/routes/message/index.js
  25. 0 {server → modules}/routes/message/unclear.js
  26. 0 {server → modules}/routes/onedrive/finish.js
  27. 0 {server → modules}/routes/onedrive/start.js
  28. 0 {server → modules}/routes/pushbullet/finish.js
  29. 0 {server → modules}/routes/pushbullet/start.js
  30. 0 {server → modules}/routes/revoke.js
  31. 0 {server → modules}/routes/services.js
  32. 0 {server → modules}/routes/status.js
  33. 0 {server → modules}/validation/count.js
  34. 0 {server → modules}/validation/sanitize.js
  35. +1 −2 nodemon.json
  36. +26 −26 server/notifier-server.js → notifier.js
  37. +6 −6 package.json
  38. 0 {server/test → tests}/appcache-spec.js
  39. 0 {server/test → tests}/archive-spec.js
  40. 0 {server/test → tests}/auth-spec.js
  41. 0 {server/test → tests}/compression-spec.js
  42. 0 {server/test → tests}/error-spec.js
  43. 0 {server/test → tests}/faye-spec.js
  44. 0 {server/test → tests}/index-spec.js
  45. 0 {server/test → tests}/login-logout-spec.js
  46. 0 {server/test → tests}/message-clear-spec.js
  47. 0 {server/test → tests}/message-spec.js
  48. 0 {server/test → tests}/world.js
  49. +2 −2 tsconfig.json
@@ -3,7 +3,7 @@ module.exports = function(grunt) {
nconf.env();

if (process.env.NODE_ENV) {
nconf.file('local', 'server/config-' + process.env.NODE_ENV + '.json');
nconf.file('local', 'config-' + process.env.NODE_ENV + '.json');
}

nconf.defaults({
@@ -29,7 +29,7 @@ To start the server, run:
By default the server will run using a reasonable default
configuration that can be selectively overriden with an externa JSON
file. This file can either be located at `/etc/notifier.json` or
within the application directory under `server/config-[env].json`
within the application directory under `config-[env].json`
where `[env]` corresponds to the value of NODE_ENV.

By default, the server runs on `localhost:8080` with a default
@@ -2,5 +2,5 @@
User=notifier
Group=notifier
WorkingDirectory={{ installation_directory }}
ExecStart={{ nodejs_path }} server/notifier-server.js
ExecStart={{ nodejs_path }} notifier.js
Environment=NODE_ENV=production
@@ -40,8 +40,7 @@ rsync -ar \
--exclude='***/.sass-cache' \
--exclude='***/.idea' \
--exclude='***/docs-build' \
--exclude='***/server/config-*.json' \
--include='server/***' \
--exclude='config-*.json' \
--include='public/***' \
--include='node_modules/***' \
--exclude='*' \
File renamed without changes.
@@ -20,11 +20,11 @@ if staged "package.json"; then
echo "...ok"
fi

if staged "Gruntfile.js"; then
echo "Checking Gruntfile.js..."
node_modules/.bin/eslint "$ROOT/Gruntfile.js"
echo "...ok"
fi
# if staged "Gruntfile.js"; then
# echo "Checking Gruntfile.js..."
# node_modules/.bin/eslint "$ROOT/Gruntfile.js"
# echo "...ok"
# fi

if staged "app"; then
echo "Checking app files..."
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.
File renamed without changes.
@@ -1,6 +1,5 @@
{
"verbose": true,
"ignore": ["test", "migrations", "flycheck_*", "#*"],
"watch": ["server", "views"],
"ignore": ["test", "flycheck_*", "#*"],
"ext": "js,ejs"
}
@@ -1,48 +1,48 @@
'use strict';
let Message = require('./models/Message'),
let Message = require('./modules/models/Message'),
Sequelize = require('sequelize'),
Token = require('./models/Token'),
User = require('./models/User'),
Token = require('./modules/models/Token'),
User = require('./modules/models/User'),
app,
archive = require('./routes/archive'),
asset = require('./middleware/asset'),
auth = require('./routes/auth'),
authBasic = require('./auth/basic.js'),
authLocal = require('./auth/local.js'),
archive = require('./modules/routes/archive'),
asset = require('./modules/middleware/asset'),
auth = require('./modules/routes/auth'),
authBasic = require('./modules/auth/basic.js'),
authLocal = require('./modules/auth/local.js'),
bayeux,
bodyParser = require('body-parser'),
compression = require('compression'),
createUser = require('./helpers/create-user'),
createUser = require('./modules/helpers/create-user'),
crypto = require('crypto'),
deauth = require('./routes/deauth'),
deauth = require('./modules/routes/deauth'),
deflate = require('permessage-deflate'),
express = require('express'),
favicon = require('./middleware/favicon'),
favicon = require('./modules/middleware/favicon'),
faye = require('faye'),
fs = require('fs'),
https = require('https'),
index = require('./routes/index'),
logger = require('./middleware/logger'),
messageClear = require('./routes/message/clear'),
messageIndex = require('./routes/message/index'),
messageUnclear = require('./routes/message/unclear'),
index = require('./modules/routes/index'),
logger = require('./modules/middleware/logger'),
messageClear = require('./modules/routes/message/clear'),
messageIndex = require('./modules/routes/message/index'),
messageUnclear = require('./modules/routes/message/unclear'),
nconf = require('nconf'),
onedriveFinish = require('./routes/onedrive/finish'),
onedriveStart = require('./routes/onedrive/start'),
onedriveFinish = require('./modules/routes/onedrive/finish'),
onedriveStart = require('./modules/routes/onedrive/start'),
passport = require('passport'),
path = require('path'),
pushbulletFinish = require('./routes/pushbullet/finish'),
pushbulletStart = require('./routes/pushbullet/start'),
pushbulletFinish = require('./modules/routes/pushbullet/finish'),
pushbulletStart = require('./modules/routes/pushbullet/start'),
responseTime = require('response-time'),
revoke = require('./routes/revoke'),
revoke = require('./modules/routes/revoke'),
router,
security = require('./middleware/security'),
security = require('./modules/middleware/security'),
sequelize,
sequelizeLogger,
services = require('./routes/services'),
status = require('./routes/status'),
validateCount = require('./validation/count'),
verifySubscription = require('./helpers/verify-subscription');
services = require('./modules/routes/services'),
status = require('./modules/routes/status'),
validateCount = require('./modules/validation/count'),
verifySubscription = require('./modules/helpers/verify-subscription');

/**
* Application configuration
@@ -3,20 +3,20 @@
"private": true,
"version": "0.0.0",
"description": "A notification service for user-generated events",
"main": "server/notifier-server.js",
"main": "notifier.js",
"scripts": {
"build": "grunt --no-color build:full",
"start": "node server/notifier-server.js",
"devserver": "NODE_ENV=dev nodemon server/notifier-server.js",
"start": "node notifier.js",
"devserver": "NODE_ENV=dev nodemon notifier.js",
"hooks": "cp hooks/* .git/hooks/",
"onemessage": "clients/send-notification -s $NOTIFIER_DEV -p 0 -t test -e '10 minutes'",
"retract": "clients/send-notification -c -l test",
"test:server": "mocha --bail --reporter min server/test",
"test:server": "mocha --bail --reporter min test",
"test:client": "karma start app/test/karma.conf.js --single-run",
"coverage:server": "istanbul cover --dir coverage/server _mocha -- -R min server/test",
"coverage:server": "istanbul cover --dir coverage/server _mocha -- -R min test",
"coverage:client": "echo 'Nope. Client coverage is automatically written by test:client'",
"deploy": "git push openshift production; clients/send-notification -g openshift -t 'Deployment complete'",
"resetdb": "rm notifier.sqlite; touch server/notifier-server.js",
"resetdb": "rm notifier.sqlite; touch notifier.js",
"prelogfetch": "mkdir -p production_logs",
"logfetch": "npm run logfetch:cron && npm run logfetch:notifier && npm run logfetch:node",
"logfetch:cron": "rhc scp notifier download production_logs app-root/logs/cron_hourly.log",
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.
@@ -6,9 +6,9 @@
"module": "commonJS"
},
"include": [
"server/**/*"
"modules/**/*"
],
"exclude": [
"server/test/*"
"test/*"
]
}

0 comments on commit 53bf93f

Please sign in to comment.