-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0bc5d13
Showing
21 changed files
with
19,648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
extends: 'airbnb-base', | ||
plugins: [ | ||
'import', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Oops, something went wrong.