Skip to content

Instantly share code, notes, and snippets.

@DiegoDoniss
Created April 6, 2022 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiegoDoniss/06f7ec1cb1ba808f56f98cb3520bb1c9 to your computer and use it in GitHub Desktop.
Save DiegoDoniss/06f7ec1cb1ba808f56f98cb3520bb1c9 to your computer and use it in GitHub Desktop.
Typescript: Express initial app
//importaciones de express
import express, { Application, json, urlencoded } from "express";
import cors from "cors";
import dotenv from 'dotenv'
//importacion de rutas
dotenv.config()
function settings(): void {
app.set("port", process.env.PORT || 3000);
}
//midlewares a implementar
function midlewares(): void {
app.use(cors());
app.use(json());
app.use(urlencoded({ extended: false }));
}
//rutas
function routes(): void {
}
export const app: Application = express()
settings()
midlewares()
routes()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment