feat: init-express-backend (#6)
Reviewed-on: #6 Co-authored-by: Clement <c.boesmier@aptatio.com> Co-committed-by: Clement <c.boesmier@aptatio.com>
This commit is contained in:
32
Express/barAndCafe/src/app.ts
Normal file
32
Express/barAndCafe/src/app.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import express from "express"
|
||||
/**
|
||||
* Initialize Express application instance.
|
||||
* @returns An initialized Express application object.
|
||||
*/
|
||||
const app = express()
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handle GET request for homepage route ('/welcome').
|
||||
* Send back a simple json response.
|
||||
* @param {express.Request} req - HTTP Request object.
|
||||
* @param {express.Response} res - HTTP Response object.
|
||||
*/
|
||||
function getWelcome(req: express.Request, res: express.Response) {
|
||||
const out = {hello:"world"}
|
||||
res.send(out)
|
||||
}
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /welcome:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a welcome json.
|
||||
*/
|
||||
app.get("/welcome", getWelcome)
|
||||
|
||||
export default app
|
Reference in New Issue
Block a user