Skip to content

Commit

Permalink
Create new project
Browse files Browse the repository at this point in the history
  • Loading branch information
nlaz committed Feb 25, 2019
0 parents commit 2203eaa
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
node_modules
npm-debug.log
package-lock.json
yarn.lock

test
temp*

.env

.DS_Store
.AppleDouble
.LSOverride

### IDE Settings (EditorConfig/Sublime)
.editorconfig

### IDE Settings (VSCode)
.vscode
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2019 Major League Hacking, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Introduction

This is a hackathon boilerplate for new Nodejs applications created by [Major League Hacking][mlh-github]. It is for hackers looking to get started quickly on a new hackathon project using the Nodejs environment.

# Code of Conduct

We enforce a Code of Conduct for all maintainers and contributors of this Guide. Read more in [CONDUCT.md][mlh-conduct].

# License

The Hackathon Starter Kit is open source software [licensed as MIT][mlh-license].

[mlh-github]: https://github.com/jekyll/jekyll/blob/master/CONDUCT.markdown
[mlh-conduct]: https://github.com/MLH/mlh-hackathon-nodejs-starter/blob/master/docs/CONDUCT.md
[mlh-license]: https://github.com/MLH/mlh-hackathon-nodejs-starter/blob/master/LICENSE.md
17 changes: 17 additions & 0 deletions app/controllers/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const express = require("express");

const router = express.Router();

router.get("/logout", function(req, res) {
// TODO
});

router.get("/login/github", function(req, res) {
// TODO
});

router.get("/callback/github", function(req, res) {
// TODO
});

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

const router = express.Router();

router.get("/requesting", function(req, res) {
// TODO
});

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

const router = express.Router();

router.get("/", function(req, res) {
// TODO
});

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

module.exports = { auth, guides, home };
18 changes: 18 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const express = require("express");
const bodyParser = require("body-parser");
const compression = require("compression");

const config = require("../config");
const { registerRoutes, registerErrorHandlers } = require("./routes");

const app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

registerRoutes(app);
registerErrorHandlers(app);

app.listen(config.port, () => {
console.log(`🚀 Server started on port ${config.port}.`);
});
18 changes: 18 additions & 0 deletions app/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const controllers = require("./controllers");
const config = require("../config");

module.exports.registerRoutes = app => {
app.use("/", controllers.home);
app.use("/auth", controllers.auth);
app.use("/guides", controllers.guide);
};

module.exports.registerErrorHandlers = app => {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render("error", {
message: err.message,
error: config.env === "development" ? err : {}
});
});
};
4 changes: 4 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
port: process.env.PORT || 5000,
env: process.env.NODE_ENV || "development"
};
18 changes: 18 additions & 0 deletions docs/CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Code of Conduct

All contributors and maintainers of this guide, in the interest of fostering an open and welcoming community, are required to adhere to the [Major League Hacking Code of Conduct][mlh-coc].

### Addendum for Open Source Projects

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to the [Major League Hacking Code of Conduct][mlh-coc], or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the [Code of Conduct][mlh-coc] may be permanently removed from the project team.

The [Major League Hacking Code of Conduct][mlh-coc] applies both within project spaces and in public spaces when an individual is representing the project or its community.

### Credits

Inspired by [Jekyll's Code of Conduct][jekyll-coc].

[mlh-coc]: https://github.com/MLH/mlh-policies/blob/master/code-of-conduct.md
[jekyll-coc]: https://github.com/jekyll/jekyll/blob/master/CONDUCT.markdown
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "mlh-hackathon-nodejs-starter",
"version": "0.1.0",
"description": "A hackathon starting point for new Nodejs applications",
"scripts": {
"start": "node app/index.js",
"deploy": "NODE_ENV=production node app/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"body-parser": "^1.18.3",
"compression": "^1.7.3",
"dotenv": "^6.2.0",
"express": "^4.16.4"
}
}

0 comments on commit 2203eaa

Please sign in to comment.