Skip to content

Commit d9ec676

Browse files
committed
chore: unused clean model registry
1 parent f791baf commit d9ec676

File tree

2 files changed

+96
-92
lines changed

2 files changed

+96
-92
lines changed

udagram-api-feed/src/server.ts

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,53 @@
1-
import cors from 'cors';
2-
import express from 'express';
3-
import {sequelize} from './sequelize';
1+
import cors from "cors";
2+
import express from "express";
3+
import { sequelize } from "./sequelize";
44

5-
import {IndexRouter} from './controllers/v0/index.router';
6-
7-
import bodyParser from 'body-parser';
8-
import {config} from './config/config';
9-
import {V0_FEED_MODELS, V0_USER_MODELS} from './controllers/v0/model.index';
5+
import { IndexRouter } from "./controllers/v0/index.router";
106

7+
import bodyParser from "body-parser";
8+
import { config } from "./config/config";
9+
import { V0_FEED_MODELS } from "./controllers/v0/model.index";
1110

1211
(async () => {
13-
await sequelize.addModels(V0_FEED_MODELS);
14-
await sequelize.addModels(V0_USER_MODELS);
15-
16-
console.debug("Initialize database connection...");
17-
await sequelize.sync();
18-
19-
const app = express();
20-
const port = process.env.PORT || 8080;
21-
22-
app.use(bodyParser.json());
23-
24-
// We set the CORS origin to * so that we don't need to
25-
// worry about the complexities of CORS this lesson. It's
26-
// something that will be covered in the next course.
27-
app.use(cors({
28-
allowedHeaders: [
29-
'Origin', 'X-Requested-With',
30-
'Content-Type', 'Accept',
31-
'X-Access-Token', 'Authorization',
32-
],
33-
methods: 'GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE',
34-
preflightContinue: true,
35-
origin: '*',
36-
}));
37-
38-
app.use('/api/v0/', IndexRouter);
39-
40-
// Root URI call
41-
app.get( '/', async ( req, res ) => {
42-
res.send( '/api/v0/' );
43-
} );
44-
45-
46-
// Start the Server
47-
app.listen( port, () => {
48-
console.log( `server running ${config.url}` );
49-
console.log( `press CTRL+C to stop server` );
50-
} );
12+
await sequelize.addModels(V0_FEED_MODELS);
13+
14+
console.debug("Initialize database connection...");
15+
await sequelize.sync();
16+
17+
const app = express();
18+
const port = process.env.PORT || 8080;
19+
20+
app.use(bodyParser.json());
21+
22+
// We set the CORS origin to * so that we don't need to
23+
// worry about the complexities of CORS this lesson. It's
24+
// something that will be covered in the next course.
25+
app.use(
26+
cors({
27+
allowedHeaders: [
28+
"Origin",
29+
"X-Requested-With",
30+
"Content-Type",
31+
"Accept",
32+
"X-Access-Token",
33+
"Authorization",
34+
],
35+
methods: "GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE",
36+
preflightContinue: true,
37+
origin: "*",
38+
})
39+
);
40+
41+
app.use("/api/v0/", IndexRouter);
42+
43+
// Root URI call
44+
app.get("/", async (req, res) => {
45+
res.send("/api/v0/");
46+
});
47+
48+
// Start the Server
49+
app.listen(port, () => {
50+
console.log(`server running ${config.url}`);
51+
console.log(`press CTRL+C to stop server`);
52+
});
5153
})();

udagram-api-user/src/server.ts

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,53 @@
1-
import cors from 'cors';
2-
import express from 'express';
3-
import {sequelize} from './sequelize';
1+
import cors from "cors";
2+
import express from "express";
3+
import { sequelize } from "./sequelize";
44

5-
import {IndexRouter} from './controllers/v0/index.router';
6-
7-
import bodyParser from 'body-parser';
8-
import {config} from './config/config';
9-
import {V0_FEED_MODELS, V0_USER_MODELS} from './controllers/v0/model.index';
5+
import { IndexRouter } from "./controllers/v0/index.router";
106

7+
import bodyParser from "body-parser";
8+
import { config } from "./config/config";
9+
import { V0_USER_MODELS } from "./controllers/v0/model.index";
1110

1211
(async () => {
13-
await sequelize.addModels(V0_FEED_MODELS);
14-
await sequelize.addModels(V0_USER_MODELS);
15-
16-
console.debug("Initialize database connection...");
17-
await sequelize.sync();
18-
19-
const app = express();
20-
const port = process.env.PORT || 8080;
21-
22-
app.use(bodyParser.json());
23-
24-
// We set the CORS origin to * so that we don't need to
25-
// worry about the complexities of CORS this lesson. It's
26-
// something that will be covered in the next course.
27-
app.use(cors({
28-
allowedHeaders: [
29-
'Origin', 'X-Requested-With',
30-
'Content-Type', 'Accept',
31-
'X-Access-Token', 'Authorization',
32-
],
33-
methods: 'GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE',
34-
preflightContinue: true,
35-
origin: '*',
36-
}));
37-
38-
app.use('/api/v0/', IndexRouter);
39-
40-
// Root URI call
41-
app.get( '/', async ( req, res ) => {
42-
res.send( '/api/v0/' );
43-
} );
44-
45-
46-
// Start the Server
47-
app.listen( port, () => {
48-
console.log( `server running ${config.url}` );
49-
console.log( `press CTRL+C to stop server` );
50-
} );
12+
await sequelize.addModels(V0_USER_MODELS);
13+
14+
console.debug("Initialize database connection...");
15+
await sequelize.sync();
16+
17+
const app = express();
18+
const port = process.env.PORT || 8080;
19+
20+
app.use(bodyParser.json());
21+
22+
// We set the CORS origin to * so that we don't need to
23+
// worry about the complexities of CORS this lesson. It's
24+
// something that will be covered in the next course.
25+
app.use(
26+
cors({
27+
allowedHeaders: [
28+
"Origin",
29+
"X-Requested-With",
30+
"Content-Type",
31+
"Accept",
32+
"X-Access-Token",
33+
"Authorization",
34+
],
35+
methods: "GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE",
36+
preflightContinue: true,
37+
origin: "*",
38+
})
39+
);
40+
41+
app.use("/api/v0/", IndexRouter);
42+
43+
// Root URI call
44+
app.get("/", async (req, res) => {
45+
res.send("/api/v0/");
46+
});
47+
48+
// Start the Server
49+
app.listen(port, () => {
50+
console.log(`server running ${config.url}`);
51+
console.log(`press CTRL+C to stop server`);
52+
});
5153
})();

0 commit comments

Comments
 (0)