bootstrap js projects
This commit is contained in:
18
express-js/src/index.ts
Normal file
18
express-js/src/index.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import express, { Application } from "express";
|
||||
import cors, { CorsOptions } from "cors";
|
||||
|
||||
export default class Server {
|
||||
constructor(app: Application) {
|
||||
this.config(app);
|
||||
}
|
||||
|
||||
private config(app: Application): void {
|
||||
const corsOptions: CorsOptions = {
|
||||
origin: "http://localhost:8081"
|
||||
};
|
||||
|
||||
app.use(cors(corsOptions));
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user