Add more testing stuff

This commit is contained in:
Stone_Red
2022-03-30 11:31:25 +02:00
parent f3bf6855e3
commit d94e918533
5 changed files with 59 additions and 11 deletions
+41
View File
@@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"@types/express": "^4.17.13",
"axios": "^0.26.1",
"express": "^4.17.3",
"ts-node": "^10.5.0",
"typescript": "^4.5.5"
@@ -287,6 +288,14 @@
"node": ">= 4.5.0"
}
},
"node_modules/axios": {
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"dependencies": {
"follow-redirects": "^1.14.8"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -1054,6 +1063,25 @@
"node": ">= 0.8"
}
},
"node_modules/follow-redirects": {
"version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -3487,6 +3515,14 @@
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"dev": true
},
"axios": {
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"requires": {
"follow-redirects": "^1.14.8"
}
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -4119,6 +4155,11 @@
"unpipe": "~1.0.0"
}
},
"follow-redirects": {
"version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
},
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+1
View File
@@ -21,6 +21,7 @@
"dependencies": {
"@prisma/client": "^3.10.0",
"@types/express": "^4.17.13",
"axios": "^0.26.1",
"express": "^4.17.3",
"prisma": "^3.10.0",
"ts-node": "^10.5.0",
@@ -0,0 +1,6 @@
import { Request, Response } from "express";
export function sayHello(request: Request, response: Response) {
console.log(request.params);
response.send(request.params.id);
}
+3 -6
View File
@@ -1,18 +1,15 @@
import express from "express";
const app = express();
let testRoutes = require('./routes/testrouter.route');
let testRoutes = require("./routes/testrouter.route");
app.use(express.json());
app.use("/tests", testRoutes);
async function main() {
app.get("/", (req, res) => {
res.send("Hello World!");
});
app.get("/api/", (req, res) => {
res.send(" welcome World running on port 3000");
})
app.listen(3000, () => {
console.log("Server is running on port 3000");
});
+8 -5
View File
@@ -1,10 +1,13 @@
import { Request, Response } from "express";
const express = require('express');
import express, { Request, Response } from "express";
import { sayHello } from "../controller/testcontroller.controller";
const router = express.Router();
router.get('/', (request: Express.Request, response: Response) => {
router.get("/", (request: Request, response: Response) => {
response.status(200).send("Cool test stuff!");
});
module.exports = router;
router.post("/test1/:id", sayHello);
module.exports = router;