Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

27 Commits

Repository files navigation

ArcJS

ArcJS: A lightweight, educational web framework for Node.js built from scratch to demystify how servers work. This project features a 100% dependency-free architecture to provide a deep, hands-on understanding of the request-response lifecycle.

Documention

-nitesh

Demo Application

importArcfrom"./src/index.mjs";constapp=Arc();application.get("/dashboard",(req,res,next)=>{console.log("Auth Check...");next();// Passes control to the next function},(req,res)=>{res.end("Welcome to the secure dashboard!");},);app.listen();// automatically listen on port 8080

Routes Function

Listening to the server

  • app.listen() listen to server by deafult runs on localhost port 8080

Methods

  • send() provide a convinent way way to send message or any json data perfectly.
  • json() sending JSON data with proper headers.
  • status() using status method, you can set response code, this return the response object So, you can chain this with other methods.
  • set() can set single or multiple headers
// use 'set()' method// setting single headerres.set("Content-Type","application/json");// setting single header with multiple valuesres.set("Set-Cookie",["uid=7h4;secure;httpOnly","username=testing;secure;httpOnly","theme=dark",]);// setting multiple headerres.set({Location: "https://www.google.com",foo: "bar","Content-Length": 899,});

Properties

  • req.path get the path name of the request.
  • req.route get the route name that is registed in.

Built In Middlwares

  • app.bodyParse This middlware handle the JSON data coming from body and shape it into json form then add into req.body property

    -nitesh

About

ArcJS: A lightweight, educational web framework for Node.js built from scratch to demystify how servers work. This project features a 100% dependency-free architecture to provide a deep, hands-on understanding of the request-response lifecycle.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages