Practice Challenges
1. Create a Basic HTTP Server
EasyServer & CoreCreate a function that returns an HTTP server configuration object with { port, host, routes }. The routes array should contain objects with { method, path, handler } for GET '/' returning 'Hello World' and GET '/health' returning { status: 'ok' }.
No global variables, No side effects, No external dependencies
Closure, Variable, Function
createServerConfig(3000) -> { port: 3000, host: 'localhost', routes: [ { method: 'GET', path: '/', response: 'Hello World' }, { method: 'GET', path: '/health', response: { status: 'ok' } } ] }
Time: O(1), Space: O(1)
Loading...