Skip to content

Creating a custom framework of express #5214

Closed

Description

@RjManhas

Hello i want to make a framework based off express like in the docs where theses frameworks do. link but how are they using express under the hood.

Activity

  1. RjManhas commented on Jun 18, 2023

    @RjManhas
    Author

    maybe a more updated / better version of this example
    https://github.com/53js/express-server-app/tree/master

  2. RjManhas commented on Jun 18, 2023

    @RjManhas
    Author

    just some extra info, basicly all i would want to do is get some options / config from the user before the server starts and then based off that, inject some routes / middleware and then functions into the app

  3. b1ek commented on Jul 18, 2023

    @b1ek

    I fail to understand what you are triyng to do. Are you tring to write an express app? Do you want to contribute to express? Do you want to create your own fork of express that will have features that the original express would never have?

    Please explain more deeply what exactly are you asking and what response you expect

  4. ayhanks commented on Aug 4, 2023

    @ayhanks

    maybe a more updated / better version of this example https://github.com/53js/express-server-app/tree/master

    I would recommend you to have a look into the source code.

    Under root/lib/application.js you can see that the express() function was called by express and they added some more methods to it.

    Here is the code in the above mentioned file:

    function application() {
    	const app = express();
    
    	Object.assign(app, {
    		start: (port) => application.start(app, port),
    		trustProxy: (value) => application.trustProxy(app, value),
    		useApiFinalMiddlewares: (options) => app.use(getApiFinalMiddlewares(options)),
    		useHealthyRoute: () => app.get('/healthy', healthy),
    		useInitialMiddlewares: (options) => app.use(getInitialMiddlewares(options)),
    		useRootRoute: () => app.get('/', root),
    	});
    
    	return app;
    }
    
  5. converted this issue into a discussion #6170 on Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions