Skip to content

Commit 672d6e0

Browse files
authored
Merge pull request #5 from boostcamp-2020/develop
1주차 작업물
2 parents 9441503 + e28886b commit 672d6e0

24 files changed

+15382
-0
lines changed

.gitignore

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/node,vscode
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,vscode
3+
4+
### Node ###
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# TypeScript v1 declaration files
49+
typings/
50+
51+
# TypeScript cache
52+
*.tsbuildinfo
53+
54+
# Optional npm cache directory
55+
.npm
56+
57+
# Optional eslint cache
58+
.eslintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variables file
76+
.env
77+
.env.test
78+
.env*.local
79+
80+
# parcel-bundler cache (https://parceljs.org/)
81+
.cache
82+
.parcel-cache
83+
84+
# Next.js build output
85+
.next
86+
87+
# Nuxt.js build / generate output
88+
.nuxt
89+
dist
90+
91+
# Gatsby files
92+
.cache/
93+
# Comment in the public line in if your project uses Gatsby and not Next.js
94+
# https://nextjs.org/blog/next-9-1#public-directory-support
95+
# public
96+
97+
# vuepress build output
98+
.vuepress/dist
99+
100+
# Serverless directories
101+
.serverless/
102+
103+
# FuseBox cache
104+
.fusebox/
105+
106+
# DynamoDB Local files
107+
.dynamodb/
108+
109+
# TernJS port file
110+
.tern-port
111+
112+
# Stores VSCode versions used for testing VSCode extensions
113+
.vscode-test
114+
115+
### vscode ###
116+
.vscode/*
117+
!.vscode/settings.json
118+
!.vscode/tasks.json
119+
!.vscode/launch.json
120+
!.vscode/extensions.json
121+
*.code-workspace
122+
123+
# End of https://www.toptal.com/developers/gitignore/api/node,vscode

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 웹 기반 스토리텔링 보드게임 DUXIT 🃏
2+
3+
<p align="center">
4+
<img src="https://i.imgur.com/RNtI3ZD.jpg" width=400>
5+
</p>
6+
7+
[![GitHub stars](https://img.shields.io/github/stars/boostcamp-2020/Project18-B-Web-Duxit.svg?style=social&label=Star)](https://github.com/boostcamp-2020/Project18-B-Web-Duxit)
8+
9+
## 공개 주소 ✨
10+
11+
[DuXit.ga](http://duxit.ga/)
12+
13+
## Team. YAHTZEE 🎲
14+
15+
> [WIKI link!](https://github.com/boostcamp-2020/Project18-B-Web-Duxit/wiki)
16+
17+
|<img src="https://avatars1.githubusercontent.com/u/67293994?s=460&v=4" width=300/>|<img src="https://avatars1.githubusercontent.com/u/48747221?s=460&u=dc79c2f93cc7fdc2c75696b59433bf429963ca29&v=4" width=300/>|<img src="https://avatars0.githubusercontent.com/u/43198553?s=460&u=ed005162bf29e3c9b4b633d1ae9b1018a971fbb3&v=4" width=300/>|<img src="https://avatars2.githubusercontent.com/u/46101366?s=460&u=f0a5173d2be366e80452962fbfaf7864cc80ab0f&v=4" width=300/>|
18+
|:-:|:-:|:-:|:-:|
19+
|J035 김민성|J060 김해람|J109 안샛별|J208 최진혁|
20+
| [@Front-line-dev](https://github.com/Front-line-dev) | [@ramram1048](https://github.com/ramram1048) | [@sbyeol3](https://github.com/sbyeol3) | [@jinhyukoo](https://github.com/jinhyukoo)
21+
22+
`🙌 든든한 멘토님인 크롱과 함께 합니다 🦖`
23+
24+
## Development Stack ⚙️
25+
26+
| division | stack |
27+
| --------------- | --------------------------------- |
28+
| Web | babel, webpack |
29+
| Front-end | Vanilla JS, TypeScript, socket.io |
30+
| Back-end | Node.js, MongoDB + Mongoose |
31+
| Production | forever, nginx, NCP |
32+
| Code Management | Git, GitHub |

src/backend/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/**/*
2+
dist/**/*

src/backend/.eslintrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
env: {
5+
node: true,
6+
},
7+
extends: ['airbnb-base', 'prettier'],
8+
plugins: ['import', 'prettier', '@babel'],
9+
parser: '@babel/eslint-parser',
10+
parserOptions: {
11+
ecmaVersion: 2020,
12+
sourceType: 'module',
13+
allowImportExportEverywhere: false,
14+
ecmaFeatures: {
15+
globalReturn: false,
16+
},
17+
babelOptions: {
18+
configFile: path.resolve(__dirname, 'babel.config.js'),
19+
},
20+
},
21+
rules: {
22+
'prettier/prettier': 'error',
23+
},
24+
};

src/backend/.prettierrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"trailingComma": "all",
9+
"bracketSpacing": true,
10+
"arrowParens": "always",
11+
"endOfLine": "lf"
12+
}

src/backend/app.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import express from 'express';
2+
import logger from 'morgan';
3+
4+
import indexRouter from './routes/index';
5+
6+
const createApplication = () => {
7+
const app = express();
8+
9+
app.use(logger('dev'));
10+
app.use(express.json());
11+
app.use(express.urlencoded({ extended: false }));
12+
13+
app.use('/', indexRouter);
14+
return app;
15+
};
16+
17+
export default createApplication;

src/backend/babel.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: {
7+
node: '12',
8+
},
9+
useBuiltIns: 'usage',
10+
corejs: 3,
11+
},
12+
],
13+
],
14+
plugins: [],
15+
};

src/backend/bin/www

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Module dependencies.
5+
*/
6+
7+
const debug = require('debug')('backend:server');
8+
const http = require('http');
9+
const { default: createApplication } = require('../app.js');
10+
11+
/**
12+
* Normalize a port into a number, string, or false.
13+
*/
14+
15+
const normalize = (val) => {
16+
const port = parseInt(val, 10);
17+
18+
if (Number.isNaN(port)) {
19+
// named pipe
20+
return val;
21+
}
22+
23+
if (port >= 0) {
24+
// port number
25+
return port;
26+
}
27+
28+
return false;
29+
};
30+
31+
/**
32+
* Event listener for HTTP server "error" event.
33+
*/
34+
35+
const onError = (error, port) => {
36+
if (error.syscall !== 'listen') {
37+
throw error;
38+
}
39+
40+
const bind = typeof port === 'string' ? `Pipe ${port}` : `Port ${port}`;
41+
42+
// handle specific listen errors with friendly messages
43+
switch (error.code) {
44+
case 'EACCES':
45+
console.error(`${bind} requires elevated privileges`);
46+
process.exit(1);
47+
break;
48+
case 'EADDRINUSE':
49+
console.error(`${bind} is already in use`);
50+
process.exit(1);
51+
break;
52+
default:
53+
throw error;
54+
}
55+
};
56+
57+
/**
58+
* Event listener for HTTP server "listening" event.
59+
*/
60+
61+
const onListening = (server) => {
62+
const addr = server.address();
63+
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;
64+
debug(`Listening on ${bind}`);
65+
};
66+
67+
/**
68+
* Get port from environment and store in Express.
69+
*/
70+
71+
const app = createApplication();
72+
73+
const normalizedPort = normalize(process.env.PORT || '3000');
74+
app.set('port', normalizedPort);
75+
76+
/**
77+
* Create HTTP server.
78+
*/
79+
80+
const server = http.createServer(app);
81+
82+
/**
83+
* Listen on provided port, on all network interfaces.
84+
*/
85+
86+
server.listen(normalizedPort);
87+
server.on('error', (error) => onError(error, normalizedPort));
88+
server.on('listening', () => onListening(server));

0 commit comments

Comments
 (0)