Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions apiRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ function apiRouter(app) {
registerXsrf();
registerMoreRouter();
registerAuthorization();
registerSStatusCodeTest();
registerStatusCodeTest();
registerStaticFunctionTest();
function registerSimpleRouter() {
router.get("/simple/get", function (req, res) {
res.json({
Expand Down Expand Up @@ -167,11 +168,19 @@ function apiRouter(app) {
}
});
}
function registerSStatusCodeTest() {
function registerStatusCodeTest() {
router.get("/more/304", function (req, res) {
res.status(304);
res.end("status: 304");
});
}
function registerStaticFunctionTest() {
router.get("/more/A", function (req, res) {
res.end("A");
});
router.get("/more/B", function (req, res) {
res.end("B");
});
}
}
exports.apiRouter = apiRouter;
17 changes: 14 additions & 3 deletions config/apiRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import bodyParser from "body-parser";
// import multipart from "connect-multiparty";
const multipart = require("connect-multiparty");

export function apiRouter(app: Router) {
export function apiRouter(app: Router): void {
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

Expand Down Expand Up @@ -37,7 +37,8 @@ export function apiRouter(app: Router) {

registerMoreRouter();
registerAuthorization();
registerSStatusCodeTest();
registerStatusCodeTest();
registerStaticFunctionTest();

function registerSimpleRouter() {
router.get("/simple/get", function (req, res) {
Expand Down Expand Up @@ -194,10 +195,20 @@ export function apiRouter(app: Router) {
});
}

function registerSStatusCodeTest() {
function registerStatusCodeTest() {
router.get("/more/304", (req: Request, res: Response) => {
res.status(304);
res.end("status: 304");
});
}

function registerStaticFunctionTest() {
router.get("/more/A", (req, res) => {
res.end("A");
});

router.get("/more/B", (req, res) => {
res.end("B");
});
}
}
6 changes: 4 additions & 2 deletions config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
"baseUrl": "../" /* Base directory to resolve non-absolute module names. */,
"paths": {
"@/*": ["./src/axios/*"]
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": ["../typings", "../node_modules/@types"],
// "typeRoots": ["../typings",] /* List of folders to include type definitions from. */,
Expand Down
3 changes: 3 additions & 0 deletions config/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const config: Configuration = {
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
alias: {
"@": path.resolve(__dirname, "./src/axios"),
},
},
module: {
rules: [
Expand Down
9 changes: 9 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./src/axios/*"]
}
},
"exclude": ["node_modules", "dist"]
}
Loading