mirror of
https://github.com/GithubOrgProjectPiza/server.git
synced 2026-09-04 16:46:07 +02:00
Add more testing stuff
This commit is contained in:
@@ -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
@@ -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");
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user