Skip to content

Commit

Permalink
🎉 Creating project
Browse files Browse the repository at this point in the history
  • Loading branch information
dennism501 committed Jul 30, 2021
0 parents commit 0bc5d13
Show file tree
Hide file tree
Showing 21 changed files with 19,648 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To Do
This web application is a simple application to manage a list of things to do.

## Infrastructure

This applications consists of two parts:
1. Frontend: Single Page Application built with: React and Material.
2. Backend: HTTP REST API built with Node.js, Express and MongoDB.

## How to run

to start the application use docker compose:

`docker-compose up --build`

once the app is running you can open:

http://localhost:3000

on your browser.
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: 'airbnb-base',
plugins: [
'import',
],
};
14 changes: 14 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# dependencies
/node_modules

# testing
/coverage

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
8 changes: 8 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:14-alpine

WORKDIR /backend

COPY package.json package-lock.json ./
RUN npm install

CMD ["npm", "start"]
37 changes: 37 additions & 0 deletions backend/bin/www
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env node
/* eslint-disable no-console */

const http = require('http');
const database = require('../src/database');
const app = require('../src/api');

function onError(error) {
console.error(`Failed to start server:\n${error.stack}`);
process.exit(1);
}

async function main() {
const port = Number(process.env.PORT || '3001');
app.set('port', port);

try {
await database.connect();
console.log('connected to database');
} catch (error) {
onError(error);
}
const server = http.createServer(app);
server.listen(port);

server.on('error', onError);

server.on('listening', () => {
const addr = server.address();
const bind = typeof addr === 'string'
? `pipe ${addr}`
: `port ${addr.port}`;
console.log(`Listening on ${bind}`);
});
}

main();
Loading

0 comments on commit 0bc5d13

Please sign in to comment.