Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up the project structure #2

Merged
merged 12 commits into from
Mar 20, 2022
Merged
Prev Previous commit
Next Next commit
add core backend web application
  • Loading branch information
tericcabrel committed Mar 17, 2022
commit 2d2048b84d8cb0af76dc1d8522c9d7833c7d6e26
2 changes: 2 additions & 0 deletions apps/core/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HOST=https://localhost
PORT=4500
118 changes: 118 additions & 0 deletions apps/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-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/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# 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 variables file
.env
.env.test
.env*.local

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

# Next.js build output
.next

# 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

# 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

# End of https://www.toptal.com/developers/gitignore/api/node

.idea
build
22 changes: 22 additions & 0 deletions apps/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "core",
"version": "1.0.0",
"description": "Sharingan core backend",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "tsc",
"dev": "nodemon --watch \"*.ts\" --exec \"ts-node\" ./src/index.ts"
},
"dependencies": {
"dotenv": "^16.0.0",
"express": "^4.17.3"
},
"devDependencies": {
"@types/express": "^4.17.13",
"@types/node": "^17.0.21",
"nodemon": "^2.0.15",
"ts-node": "^9.1.1",
"typescript": "^4.6.2"
}
}
20 changes: 20 additions & 0 deletions apps/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import express from 'express';
import dotenv from 'dotenv';

dotenv.config();

const HOST = process.env.HOST || 'https://localhost';
const PORT = parseInt(process.env.PORT || '4500');

const app = express();

app.use(express.urlencoded({ extended: true }));
app.use(express.json());

app.get('/', (req, res) => {
return res.json({ message: 'Hello World!' });
});

app.listen(PORT, () => {
console.log(`Application started on URL ${HOST}:${PORT} 🎉`);
});
22 changes: 22 additions & 0 deletions apps/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["dom"], /* Specify library files to be included in the compilation. */
"outDir": "./dist",
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
/* Experimental Options */
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */
},
"include": [
"./src/**/*",
],
"exclude": [
"node_modules"
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"devDependencies": {
"prettier": "^2.6.0",
"turbo": "^1.1.6"
}
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**"]
"outputs": [".next/**", "dist/**"]
},
"test": {
"dependsOn": ["^build"],
Expand Down
Loading