Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. //src/app.ts
  2. import express from "express";
  3. import { Application } from 'express';
  4. import bodyParser from "body-parser";
  5. import cors from "cors";
  6. class App {
  7. public app: Application;
  8. constructor() {
  9. this.app = express();
  10. this.setConfig(); }
  11. private setConfig() {
  12. //Allows us to receive requests with data in json format
  13. this.app.use(bodyParser.json({ limit: "50mb" }));
  14.  
  15. //Allows us to receive requests with data in x-www-form-urlencoded format
  16. this.app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
  17. //Enables cors
  18. this.app.use(cors());
  19. }
  20. }
  21. export default new App().app;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement