You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
454 B
19 lines
454 B
const express = require("express");
|
|
const app = express();
|
|
const port = process.env.PORT || 8080;
|
|
|
|
app.get("/", (req, res) => {
|
|
res.send(
|
|
"<h1 style='text-align: center; font-size: 64px'>This is Demo site from node.js project</h1>"
|
|
);
|
|
});
|
|
|
|
app.get("/user", function(req, res) {
|
|
res.status(200).json({ name: "appleboy" });
|
|
});
|
|
|
|
// listen 8080 port
|
|
app.listen(port);
|
|
console.log("Listening on port " + port);
|
|
|
|
module.exports = app; // for testing
|