-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from OrcaPracticas/add/init
⚙️ Configuración inicial
- Loading branch information
Showing
13 changed files
with
137 additions
and
4 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,22 @@ | ||
const ENV = require("./app/config/env-config"); | ||
|
||
module.exports = { | ||
presets: ["@babel/preset-env"], | ||
plugins: [ | ||
"inline-json-import", | ||
[ | ||
"module-resolver", | ||
{ | ||
alias: { | ||
"Controller": "./app/src/controller/", | ||
"Models": "./app/src/models/", | ||
"Tools": "./app/src/tools/", | ||
} | ||
} | ||
], | ||
[ | ||
"transform-define", | ||
{ ...ENV }, | ||
], | ||
], | ||
}; |
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 @@ | ||
{ | ||
"extends": [ | ||
"airbnb", | ||
"prettier" | ||
], | ||
"parser": "babel-eslint", | ||
"plugins": [ | ||
"prettier", | ||
"module-resolver" | ||
], | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"module-resolver/use-alias": 2 | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"babel-module": {} | ||
} | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"printWidth": 100, | ||
"trailingComma": "all", | ||
"tabWidth": 4, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
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 @@ | ||
const APP_PORT = process.env.PORT || 3000; | ||
|
||
// variables de entorno | ||
module.exports = { | ||
"process.env.PORT": APP_PORT, | ||
}; |
Binary file not shown.
Empty file.
Empty file.
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,46 @@ | ||
import Compression from "compression"; | ||
import Cors from "cors"; | ||
import Express, { Router, static as Statics } from "express"; | ||
import BodyParser from "body-parser"; | ||
import Helmet, { frameguard } from "helmet"; | ||
import Path from "path"; | ||
|
||
import ApiRouter from "./router"; | ||
|
||
// ======================== CONSTANTES ======================== // | ||
|
||
const APP_PORT = process.env.PORT; | ||
const ROOT_PATH = Path.join(__dirname, "../../"); | ||
const Server = Express(); | ||
|
||
// ==================== COMNFIGURACIONES ==================== // | ||
|
||
Server.use(Cors()); | ||
|
||
Server.use(Helmet()); | ||
Server.use(frameguard({ action: "allow-from", domain: "*" })); | ||
|
||
Server.use(Compression({ threshold: 0 })); | ||
|
||
// ==================== PARSEO DE PARAMETROS ==================== // | ||
|
||
Server.use(BodyParser.urlencoded({ extended: false })); | ||
Server.use(BodyParser.json()); | ||
|
||
// ==================== ARCHIVOS STATICOS ==================== // | ||
|
||
Server.use("/", Statics(`${ROOT_PATH}/public/`)); | ||
|
||
// ===================== MANEJO DE RUTAS ====================== // | ||
|
||
Server.use(ApiRouter(Router)); | ||
|
||
// ====================== ESTABLECIENDO CONEXIÓN ====================== // | ||
|
||
Server.listen(APP_PORT, (error) => { | ||
if (error) { | ||
console.log(error); | ||
} else { | ||
console.log(`Servidro listo ${APP_PORT}`); | ||
} | ||
}); |
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,11 @@ | ||
const ApiRouter = (router) => { | ||
const Router = router(); | ||
Router.use((request, response) => { | ||
response.status(200); | ||
response.send("<h1>Hola Mundo !</h1>"); | ||
}); | ||
|
||
return Router; | ||
}; | ||
|
||
export default ApiRouter; |
Empty file.
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 @@ | ||
{ | ||
"verbose": true, | ||
"ignore": [ | ||
"node_modules", | ||
"./app/public" | ||
], | ||
"watch": [ | ||
"./app/src", | ||
"./app/src/controller", | ||
"./app/src/model", | ||
"./run_app.js" | ||
], | ||
"ext": "js json" | ||
} |
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
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,5 @@ | ||
/** | ||
* Launches the app server. | ||
*/ | ||
require("@babel/register"); // eslint-disable-line | ||
require("./app/src/server/index"); |