GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Generic app constructor by dranikpg · Pull Request #408 · CrowCpp/Crow

Conversation

@dranikpg

@dranikpg dranikpg commented Apr 13, 2022

Copy link
Copy Markdown
Member

The crow app currently has only a default constructor. This is quite unhandy for initializing middleware, as all of them have to be default-construtible and have to be initialized manually by extracting them out of the app one by one.

Instead, users should be able to provide already constructed middleware. Ideally this should work without listing all middleware, but only by specifying the required ones.

What works now:

// no default or copy constructor required, it supports move-only
struct D {
  D() = delete;
  D(const D&) = delete;
};

// Any subset can be specified
// in any order
crow::App<A, B, C, D> app(D{args...}, A{args...});

What it looked like before:

crow::App<A, B, C, D> app;
app.get_middleware<A>() = A{args...};
app.get_middleware<D>() = D{args...};

Note: this has to be merged after blueprint middleware, as it has some conflicts. Just puttin' it on the waiting list 😃

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
dranikpg added 3 commits April 13, 2022 20:49
@dranikpg
Generic app constructor
74d9488
@dranikpg
Merge branch 'master' into app-constructor
94fa9f7
@dranikpg
Small fixes
9462927
@The-EDev

The-EDev commented May 23, 2022

Copy link
Copy Markdown
Member

I'm guessing this is ready for review? @dranikpg

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dranikpg

dranikpg commented May 23, 2022

Copy link
Copy Markdown
Member Author

It is. I've just been waiting for the CI build to finish 👀 It did so for amd64, so it'll most likely for the other targets

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dranikpg
dranikpg marked this pull request as ready for review May 23, 2022 18:16
@The-EDev

The-EDev commented May 23, 2022

Copy link
Copy Markdown
Member

seems like the test was blocked for ARM64, might be a one off bug..

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

The-EDev
The-EDev approved these changes May 23, 2022
View reviewed changes

@The-EDev The-EDev left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems to be alright. Thanks a lot for your work and patience @dranikpg

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@The-EDev

The-EDev commented May 23, 2022

Copy link
Copy Markdown
Member

Note to self: It might be worth documenting this feature either in guides or examples.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@The-EDev
The-EDev merged commit 0fb91ae into CrowCpp:master May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@The-EDev The-EDev The-EDev approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@dranikpg @The-EDev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.