Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

Commit

Permalink
Set up basic app
Browse files Browse the repository at this point in the history
  • Loading branch information
kzalys committed Jul 8, 2018
1 parent 15b00a5 commit 38175d5
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
.env
.eslintrc
.env
5 changes: 5 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alexdmtr
andreimuntean
AndrewBLC
kzalys
MisterDoom
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 HackSoc

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.
24 changes: 24 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
const express = require('express');
const morgan = require('morgan');
const bodyParser = require('body-parser');

const port = process.env.PORT || 5000;
const app = express();

app.use(morgan(process.env.ENVIRONMENT));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json({ extended: false }));

// The request was not handled by any of the routers, send a 404 error
app.use(function(req, res){
res.status(404);

// respond with html page
if (req.accepts('html')) {
res.render('404', { url: req.url });
return;
}

// respond with json
if (req.accepts('json')) {
res.send({ error: 'Not found' });
return;
}

// default to plain-text. send()
res.type('txt').send('Not found');
});

app.listen(port);
console.log("App started on port: " + port);
Empty file added routes/MainRoutes.js
Empty file.

0 comments on commit 38175d5

Please sign in to comment.