Skip to content

Commit

Permalink
Merge pull request #1 from jjikky/feature/structure
Browse files Browse the repository at this point in the history
Feature/structure : 프로젝트 기본 구조 설정
  • Loading branch information
jjikky authored Jun 16, 2024
2 parents 2decf90 + 0c5e3ab commit 7d8b7cc
Show file tree
Hide file tree
Showing 14 changed files with 9,194 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto",
"singleQuote": true,
"useTabs": false
}
],
"no-console": "off"
},
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"env": {
"browser": true,
"node": true
}
}
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Image
uploads


# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tabWidth": 4,
"printWidth": 120,
"semi": true,
"useTabs": false,
"trailingComma": "es5",
"singleQuote": true,
"jsxSingleQuote": true,
"endOfLine": "auto"
}
37 changes: 37 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const express = require('express');
const path = require('path');
const morgan = require('morgan');
const helmet = require('helmet');
const cors = require('cors');
const userRouter = require('./routes/user/user.route');
const wordRouter = require('./routes/word/word.route');
const cookieParser = require('cookie-parser');
const dotenv = require('dotenv');

dotenv.config();

const app = express();

app.use(morgan('dev'));
app.use(helmet());

app.use(cors({ credentials: true, origin: 'http://localhost:3000' }));
app.use(express.json());
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

// EB health check
app.get('/', (_, res) => {
res.status(200).json({ message: 'Success' });
});
app.use('/users', userRouter);
app.use('/words', wordRouter);

app.all('*', (req, res) => {
res.status(404).json(`Can't find ${req.originalUrl} on this server`)
});

const PORT = process.env.PORT;
app.listen(PORT, () => {
console.log(`app listening on http://localhost:${PORT}`);
});
Loading

0 comments on commit 7d8b7cc

Please sign in to comment.