forked from dartmouth-cs52/slackattack
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6da89eb
Showing
7 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "stage-2"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
extends: "airbnb", | ||
parser: "babel-eslint", | ||
env: { | ||
browser: false, | ||
node: true, | ||
es6: true | ||
}, | ||
rules: { | ||
strict: 0, | ||
quotes: [2, "single"], | ||
no-else-return: 0, | ||
new-cap: ["error", {"capIsNewExceptions": ["Router"]}], | ||
no-console: 0, | ||
import/no-unresolved: [2, { commonjs: true}], | ||
no-unused-vars: ["error", { "vars": "all", "args": "none" }], | ||
no-underscore-dangle: 0, | ||
arrow-body-style: ["error", "always"] | ||
}, | ||
plugins: [ | ||
'import' | ||
], | ||
ecmaFeatures: { | ||
jsx: true, | ||
modules: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
config.js | ||
npm-debug.log | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: npm run prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# cs52 simple blog express api # | ||
|
||
uses es6 with babel for prettiness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import express from 'express'; | ||
import bodyParser from 'body-parser'; | ||
import cors from 'cors'; | ||
|
||
// configure app to use bodyParser() | ||
// this will let us get the data from a POST | ||
const app = express(); | ||
|
||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(cors()); // allows all | ||
app.use(bodyParser.json()); | ||
|
||
|
||
// default index route | ||
app.get('/', (req, res) => { | ||
res.send('hi'); | ||
}); | ||
|
||
// START THE SERVER | ||
// ============================================================================= | ||
const port = process.env.PORT || 9090; | ||
app.listen(port); | ||
|
||
console.log(`listening on: ${port}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "example_express_with_es6", | ||
"version": "1.0.0", | ||
"description": "", | ||
"author": "Tim Tregubov", | ||
"main": "app/server.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"dev": "nodemon app/server.js --exec babel-node", | ||
"start": "babel-node app/server.js", | ||
"build": "babel app -d dist", | ||
"prod": "npm run build; node dist/server.js" | ||
}, | ||
"license": "ISC", | ||
"dependencies": { | ||
"body-parser": "^1.15.1", | ||
"cors": "^2.7.1", | ||
"express": "^4.13.4", | ||
"babel-cli": "^6.9.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-2": "^6.5.0" | ||
|
||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^6.0.4", | ||
"eslint": "^2.11.1", | ||
"eslint-config-airbnb": "^9.0.1", | ||
"eslint-plugin-import": "^1.8.1", | ||
"eslint-plugin-jsx-a11y": "^1.3.0", | ||
"eslint-plugin-react": "^5.1.1", | ||
"nodemon": "^1.9.2" | ||
} | ||
} |