Browse Source

Initial commit

sbkwgh 8 years ago
commit
0faa6abcb1
3 changed files with 98 additions and 0 deletions
  1. 56 0
      .gitignore
  2. 22 0
      package.json
  3. 20 0
      server.js

+ 56 - 0
.gitignore

@@ -0,0 +1,56 @@
+# Config file
+config.js
+
+# Logs
+logs
+*.log
+npm-debug.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules
+jspm_packages
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env

+ 22 - 0
package.json

@@ -0,0 +1,22 @@
+{
+  "name": "backend",
+  "version": "0.0.0",
+  "description": "Backend for forum",
+  "main": "server.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node server.js"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "body-parser": "^1.16.0",
+    "express": "^4.14.1",
+    "pg": "^6.1.2",
+    "pg-hstore": "^2.3.2",
+    "sequelize": "^3.30.0"
+  },
+  "devDependencies": {
+    "morgan": "^1.7.0"
+  }
+}

+ 20 - 0
server.js

@@ -0,0 +1,20 @@
+let express = require('express')
+let app = express()
+
+let config = require('./config.js')
+
+//Middle-ware
+let bodyParser = require('body-parser')
+let morgan = require('morgan')
+
+app.use(bodyParser.json())
+
+if(process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'production') {
+	app.use(morgan('dev'))
+}
+
+app.listen(config.port, () => {
+	console.log('Listening on ' + config.port)
+})
+
+module.exports = app