move app source
This commit is contained in:
parent
04dfb78d57
commit
94b2ce2d16
21
Express/barAndCafe/src/app.ts
Normal file
21
Express/barAndCafe/src/app.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import express from "express";
|
||||
|
||||
/**
|
||||
* Initialize Express application instance.
|
||||
* @returns An initialized Express application object.
|
||||
*/
|
||||
const app = express();
|
||||
|
||||
/**
|
||||
* Handle GET request for homepage route ('/').
|
||||
* Send back a simple text response.
|
||||
* @param {express.Request} req - HTTP Request object.
|
||||
* @param {express.Response} res - HTTP Response object.
|
||||
*/
|
||||
function getRoot(req: express.Request, res: express.Response) {
|
||||
res.send("hello world from dev");
|
||||
}
|
||||
|
||||
app.get("/", getRoot);
|
||||
|
||||
export default app;
|
@ -1,16 +1,10 @@
|
||||
import express from "express";
|
||||
import * as dotenv from "dotenv";
|
||||
import app from "./app";
|
||||
|
||||
dotenv.config({path: '../../.env'})
|
||||
|
||||
const port = parseInt(process.env.BAR_PORT || '3000')
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("helloworld form dev")
|
||||
})
|
||||
|
||||
app.listen(port, () =>{
|
||||
console.log(`serveur running in ${port}`)
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user