Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a section that shows how concepts in other frameworks apply using minimal APIs #47

Open
1 of 3 tasks
davidfowl opened this issue Aug 29, 2021 · 7 comments
Open
1 of 3 tasks

Comments

@davidfowl
Copy link
Collaborator

davidfowl commented Aug 29, 2021

What would you like see:

  • Documentation
  • Sample
  • Tutorial

What kind of content are you looking for ?

We should have a section on the site that lists a couple of top level concepts in various frameworks (routing, middleware, logging, dependency injection (where applicable)), as a way to quickly get somebody that is already using an existing framework up to speed with similar concepts in minimal.

For example:

Express

Routes

// GET method route
app.get('/', function (req, res) {
  res.send('GET request to the homepage')
})

// POST method route
app.post('/', function (req, res) {
  res.send('POST request to the homepage')
})
app.MapGet("/", () => "GET request to the homepage");
app.MapPost("/", () => "POST request to the homepage");

Route parameters

app.get('/users/:userId/books/:bookId', function (req, res) {
  res.send(req.params)
})
app.MapGet("/users/{userId}/books/{bookId}", (int userId, int bookId) => { 
   return new { userId, bookId };
});

Middleware

var express = require('express')
var app = express()

app.use(function (req, res, next) {
  console.log('Time:', Date.now())
  next()
})
var app = WebApplication.Create(args);

app.Use((context, next) => 
{
    Console.WriteLine($"Time: {DateTime.Now}");
    return next(context);
});

StaticFiles

var express = require('express')
var app = express()

app.use(express.static('public', options))
var app = WebApplication.Create(args);
app.UseStaticFiles();
@LadyNaggaga
Copy link
Contributor

Isn't this already covered in the current quick start https://minimal-apis.github.io/quickstart/quickstart.html

@davidfowl
Copy link
Collaborator Author

There's no plan to cover other frameworks in that set. This is about having a "if you know framework X" here's how you do it in minimal comparison

@LadyNaggaga
Copy link
Contributor

What about something like this on the homepage under features? I don't know if we should do entire section. TBH I don't know where this would be go in the page flow

image

@LadyNaggaga
Copy link
Contributor

Maybe I could add an about page ...

@davidfowl
Copy link
Collaborator Author

I think it should be a different page. One per framework. One for express and one for flask, and maybe a golang framework.

@LadyNaggaga
Copy link
Contributor

😑 I am not sure about this. But we could add a section under the quick starts. But it may get lost. Right now this what we have
Top menus

@davidfowl
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants