Skip to content

Commit 68e2271

Browse files
committed
feat(templates): move routes.ts to components/index.ts, export components path '/' along with routes, rename Routes interface to RouteOptions
1 parent 42b2f71 commit 68e2271

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

generators/app/templates/src/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
handleErrors,
99
} from '@boringcodes/utils/express';
1010

11-
import routes from './routes';
11+
import components from './components';
1212

1313
// initialize app
1414
const app = express();
@@ -20,8 +20,8 @@ app.use(bodyParser.urlencoded({ extended: true }));
2020
app.use(bodyParser.json());
2121
app.use(health());
2222

23-
// plug routes
24-
app.use(routes({ dev }));
23+
// plug components
24+
app.use(components.path, components.routes({ dev }));
2525

2626
// handle errors
2727
app.use(handleNotFound);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Router } from 'express';
2+
3+
// TODO: import components
4+
// import things from './things';
5+
6+
interface RouteOptions {
7+
readonly dev: boolean;
8+
}
9+
10+
const path = '/';
11+
12+
const routes = (_: RouteOptions) => {
13+
const router = Router();
14+
15+
// TODO: register components to router
16+
// router.use(things.path, things.routes(_));
17+
18+
return router;
19+
};
20+
21+
export default { path, routes };
22+
export { RouteOptions };

generators/app/templates/src/components/types.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

generators/app/templates/src/routes.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)