Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const http = require("http");
- http.createServer((req, res) => {
- res.writeHead(200, { 'Content-Type': 'application/json' });
- if(req.url === "/produto"){
- res.end(
- JSON.stringify({
- message: "Rota de produto",
- })
- );
- }
- if(req.url === "/usuarios"){
- res.end(
- JSON.stringify({
- message: "Rota de usuário",
- })
- );
- }
- res.end(
- JSON.stringify({
- message: "Julius usando node.js",
- })
- );
- }).listen(2345, () => console.log("Julius server is running! (Port 2345)"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement