Supranim performs many automatic setups, from macro-based initializers to automatic discovery of service providers and other Nim modules.
This file is the main entry point for the Supranim application and is responsible for bootstrapping the application, loading configurations, and starting the server.
Macros
macro runBaseMiddlewares(req, res)
- Executes the registered base middlewares in order. If any middleware returns false, it means that the request has been handled and we should not continue processing it.
Templates
template getBaseMiddlewares(req, res) {.dirty.}
- Walk through the registered base middlewares and execute them in order.
template run(app: Application)
- Runs the Supranim application server without an optional block.
template run(app: Application; optionalBlock: untyped) {.dirty.}
-
Runs the Supranim application server
This is the main entry point for starting the application. It sets up the HTTP server and defines the request handling logic, including routing and middleware execution.
Optionally, you can provide an optionalBlock of code that will be executed during the server startup process, allowing you to inject custom logic or perform additional setup before the server starts accepting requests.
For low-level server control, check the code inside this template and the onRequest procedure to see how requests are processed and how the server is started.
Exports
-
Services, services, getPort, migrationPath, SafeThreadVarSeq, configPath, p, getInstallationPath, getAddress, paths, middlewarePath, withThreadCallback, appInstance, resolve, storagePath, AppInstance, Application, initApplication, injectSafeThreadCallbacks, JsonString, init, consolePath, withAssetsHandler, databasePath, config, registerCallback, pluginsPath, App, logsPath, unregisterCallback, runtimeConfigPath, controllerPath, basePath, info, initHttpRouter, servicePath, cli, ApplicationAssetsHandler, initStartCommand, loadEventListeners, eventsPath, appInitialized, modelPath, init, AppConfigDefect, ApplicationPaths, getUuid, cachePath, ApplicationThreadCallback, rootPath, sendChunk, unregisterCallback, addCallback, getBody, getQuery, newWebServer, sendFile, getIp, send, addHeader, getOutputHeaders, BodyStream, StartupCallback, removeHeader, addEvent, getBodyStream, newWebServer, startChunk, withChunks, WebServer, drainChunk, runServer, getHeaders, streamFile, OnRequest, getHeader, Request, startPartialChunk, clearHeaders, readChunk, registerCallback, addCallback, findHeader, send, dropRequest, sendFile, send, start, endChunk, OnRequestLowLevel, getMethod, peekChunk, send, start, start, setOnMessage, WebSocketConnection, websocketUpgrade, close, sendText, sendBinary, sendPing, setOnError, sendText, OpenCb, sendFrame, close, sendBinary, setOnClose, WebSocketConnectionImpl, sendFrame, MessageCb, WebSocketFrameKind, CloseCb, setOnOpen, sendPing, ErrorCb, resolveMiddleware, Afterware, baseMiddlewares, searchRouteWs, registerRoute, routes, HttpRouterInstance, HttpRouterError, initRouterErrorHandlers, DefaultHttpError, RouteCheckResult, checkExists, Middleware, preparePath, Callable, resolveAfterware, registerRoute, queuedRoutes, HttpRoute, errorHandler, HttpRouteWs, newHttpRouter, httpMethods, call4xx, HttpRouteType, parseRouteNode, checkWsExists, sendEmbeddedAsset, sendAssets, sendDownloadable, sendAssets, getEventEmitterInstance, listener, init, OnInitSingletonCallback`gensym0`gensym5, event, redirectTo, getCookies, getFieldsJson, ctrl, redirectUri, getIp, json, respond, addHeader, $, setBody, sendJson, getFieldsTableJson, getUriPath, resp, redirect, Request, setParams, send, go, BodyData, Response, emptyResponseBody, getPlatform, SomeBodyData, getDefault, getFields, getBodyDataJson, streamFile, toString, getSomeBodyData, send, getCode, getRequestBody, go, storage, send, getAgent, sendAssets, getHeaders, params, redirect301, getContentType, getFieldsTable, getSessionCookie, getBody, getBody, getQuery, sendDownloadable, getUrl, hasCookies, getClientData, getQueryTable, getHeader, send, getHttpMethod, findHeader, getClientId, getBrowserName, isAuth, respond, sendEmbeddedAsset, newController, getBodyData, sendAssets, setCode, getHeaders, $, releaseUnusedMemory