feat: init-express-backend #6

Merged
Clement merged 38 commits from feat--init-express-backend into master 2024-05-06 19:20:30 +00:00
2 changed files with 22 additions and 7 deletions
Showing only changes of commit 94b2ce2d16 - Show all commits

View 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;

View File

@ -1,16 +1,10 @@
import express from "express";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import app from "./app";
dotenv.config({path: '../../.env'}) dotenv.config({path: '../../.env'})
const port = parseInt(process.env.BAR_PORT || '3000') const port = parseInt(process.env.BAR_PORT || '3000')
const app = express();
app.get("/", (req, res) => {
res.send("helloworld form dev")
})
app.listen(port, () =>{ app.listen(port, () =>{
console.log(`serveur running in ${port}`) console.log(`serveur running in ${port}`)
}) })