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

Initial server #20

Merged
merged 2 commits into from
Oct 2, 2018
Merged
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
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "airbnb-base"
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "marna-house",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node src/index",
"dev": "nodemon src/index"
},
"repository": {
"type": "git",
"url": "git+https://github.com/FACG5/Marna-House.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/FACG5/Marna-House/issues"
},
"homepage": "https://github.com/FACG5/Marna-House#readme",
"keywords": [],
"devDependencies": {
"eslint": "^5.6.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"istanbul": "^0.4.5",
"nodemon": "^1.18.4",
"tap-spec": "^5.0.0",
"tape": "^4.9.1"
},
"dependencies": {
"express": "^4.16.3",
"express-handlebars": "^3.0.0"
}
}
26 changes: 26 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const express = require('express');
const hbs = require('express-handlebars');
const path = require('path');
const controller = require('./controllers');

const app = express();

// Middlewares
app.set('port', process.env.PORT || 3000);
app.disable('x-powered-by');
app.use(express.json());
app.use(express.urlencoded());
app.use(controller);

// HandleBars
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
app.engine('hbs', hbs({
extname: 'hbs',
partialsDir: path.join(__dirname, 'views', 'partials'),
layoutsDir: path.join(__dirname, 'views', 'layouts'),
defaultLayout: 'main',
}));


module.exports = app;
4 changes: 4 additions & 0 deletions src/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const router = require('express').Router();


module.exports = router;
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const app = require('./app');

app.listen(app.get('port'), () => {
console.log(`The Server is Running on Port ${app.get('port')}`);
});