This is for the API forward base on the Express node framework.
const express = require("express");
const app = express();
app.get("/api", (req, res) => {
res.send("Hello !");
});
app.listen(3000, () => {
console.log("Listening on port 3000...");
});
export PORT=8000 //Mac
set PORT=8000 //Windows
- Express:
Back-end API framework - nodemon:
Runnpx nodemon FILENAME.js
for watch the changes and run the service. - joi:
The request validation check package. - cors:
The CORS error configuration. - urlencode:
The urlencode / urldecode package. (rawurlencode)
Official Library:
Request Document: