Skip to content
Snippets Groups Projects
Commit b2a3291d authored by Renzo Beux's avatar Renzo Beux
Browse files

init: initialization of project structure

parent 3c2896c0
No related branches found
No related tags found
No related merge requests found
.env 0 → 100644
PORT=8000
\ No newline at end of file
node_modules
build
npm-debug.log
.DS_Store
\ No newline at end of file
This diff is collapsed.
{
"name": "repp_backend",
"version": "1.0.0",
"description": "Herramienta de calculo de requerimiento energetico ponderado para una poblacion. Este repositorio contiene el backend.",
"description": "Herramienta de calculo del requerimiento energetico ponderado de una poblacion, llamado REPP.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitlab.fing.edu.uy/julieta.dubra/repp_backend.git"
},
"author": "",
"license": "ISC",
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.25.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^4.3.8",
"jest": "^27.0.6",
"lint-staged": "^11.1.2"
},
"scripts": {
"test": "jest",
"pretest": "./node_modules/.bin/eslint --ignore-path .gitignore . --fix"
},
"repository": {
"type": "git",
"url": "https://gitlab.fing.edu.uy/julieta.dubra/repp.git"
},
"author": "",
"license": "ISC",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
......
import express, {Request,Response,Application} from 'express';
const parseExcel = async (req:Request, res:Response) => {
}
module.exports = {
parseExcel
}
\ No newline at end of file
Aca van los DAOs, los daos son los archivos que tienen comunicacion directa con la BD. Ningun otro archivo que no sea un dao puede tener acceso directo a la BD
\ No newline at end of file
Aca van los enumerados, elemental watson
\ No newline at end of file
Aca van las interfaces, acordarse de como nombrarlas, esta en el documento en Teams
\ No newline at end of file
Aca van los modelos, osea los "tipos"
\ No newline at end of file
Aca van los servicios, oh wew
\ No newline at end of file
import express, {Request,Response,Application} from 'express';
const swaggerJsDoc = require('swagger-jsdoc')
const swaggerUi = require('swagger-ui-express')
const app:Application = express();
const PORT = process.env.PORT || 8000;
// swagger init
const swaggerOptions = {
swaggerDefinition: {
openapi: '3.0.0',
info: {
title: 'REPP Rest API',
description: '',
servers: ['http://localhost:3000']
}
},
apis: ['src/routes.ts']
}
const swaggerDocs = swaggerJsDoc(swaggerOptions)
// middlewares
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocs))
app.use(require('./routes.ts'))
app.listen(PORT, ():void => {
console.log(`REPP Backend running here 👉 https://localhost:${PORT}`);
});
\ No newline at end of file
import express, {Request,Response,Application} from 'express';
const {parseExcel} = require('./Controllers/ExcelController')
const { Router } = require('express');
const router = Router();
router.get('/',(req:Request, res:Response):void => {
res.send("Hey! This is REPP API, you can go to /api-docs to learn more!")
})
//Che esto es para ejemplo de como usar swagger, hay que arreglarlo
//TODO
/**
* @swagger
* /excelParser:
* post:
* tags:
* - parser
* description: Excel Parser
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - email
* - password
* properties:
* excel:
* type: string
* responses:
* '200':
* description: returns the parsed JSON of the excel file provided
* content:
* application/json:
* schema:
* type: object
* properties:
* excelParsed:
* type: string
*/
router.post('/excelParser', parseExcel)
module.exports = router
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment