{"id":86,"date":"2024-02-16T15:07:03","date_gmt":"2024-02-16T15:07:03","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/a_mermur\/?p=86"},"modified":"2024-02-16T15:18:34","modified_gmt":"2024-02-16T15:18:34","slug":"express-js-using","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/a_mermur\/2024\/02\/16\/express-js-using\/","title":{"rendered":"Express.js using"},"content":{"rendered":"\n<p>I started using express.js to my backend and I am doing the 404 err page<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"481\" src=\"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-content\/uploads\/2024\/02\/script-1024x481.png\" alt=\"\" class=\"wp-image-87\" srcset=\"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-content\/uploads\/2024\/02\/script-1024x481.png 1024w, https:\/\/theroyalscode.com\/students\/a_mermur\/wp-content\/uploads\/2024\/02\/script-300x141.png 300w, https:\/\/theroyalscode.com\/students\/a_mermur\/wp-content\/uploads\/2024\/02\/script-768x361.png 768w, https:\/\/theroyalscode.com\/students\/a_mermur\/wp-content\/uploads\/2024\/02\/script.png 1117w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>const express = require('express');\r\nconst bodyParser = require('body-parser');\r\nconst app = express();\r\napp.use(bodyParser.urlencoded({ extended: false }));\r\napp.use(bodyParser.json());\r\n\r\napp.use(async (req, res) => {\r\n    res.status(404).json({ error: 'Not Found' });\r\n});\r\n\r\n\r\n\r\napp.listen(3000, async () => {\r\n    console.log(\"\\x1b&#91;33mServer listening at http:\/\/localhost:3000\\x1b&#91;37m\");\r\n});<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I started using express.js to my backend and I am doing the 404 err page<\/p>\n","protected":false},"author":1,"featured_media":87,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":88,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts\/86\/revisions\/88"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/media\/87"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}