Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
timofei7 committed Jun 8, 2016
0 parents commit 6da89eb
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "stage-2"]
}
27 changes: 27 additions & 0 deletions .eslintrc
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
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
config.js
npm-debug.log
dist
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run prod
3 changes: 3 additions & 0 deletions README.md
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
24 changes: 24 additions & 0 deletions app/server.js
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}`);
33 changes: 33 additions & 0 deletions package.json
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"
}
}

0 comments on commit 6da89eb

Please sign in to comment.