-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
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();Metadata
Metadata
Assignees
Labels
No labels