MCPcopy
hub / github.com/express-rate-limit/express-rate-limit / createServer

Function createServer

test/library/helpers/create-server.ts:18–42  ·  view source on GitHub ↗
(
	middleware: RequestHandler | RequestHandler[],
)

Source from the content-addressed store, hash-verified

16 * @returns {Express.Application} - The express server
17 */
18export const createServer = (
19 middleware: RequestHandler | RequestHandler[],
20): Application => {
21 // Create an Express server
22 const app = createApp()
23
24 // Use the middleware
25 app.use(middleware)
26
27 // Register test routes
28 app.all('/', (_request: Request, response: Response) => {
29 response.send('Hi there!')
30 })
31 app.get('/error', (_request: Request, response: Response) => {
32 response.sendStatus(400)
33 })
34 app.post('/crash', (_request: Request, response: Response) => {
35 const error = new Error('Oops!')
36 response.destroy(error)
37 response.emit('error', error)
38 })
39
40 // Return the application instance
41 return app
42}

Callers 15

middleware-test.tsFile · 0.85
headers-test.tsFile · 0.85
mongo-store.tsFile · 0.85
redis-store.tsFile · 0.85
memcached-store.tsFile · 0.85
precise-store.tsFile · 0.85
app.tsFile · 0.85
app.jsFile · 0.85
app.tsFile · 0.85
app.jsFile · 0.85
app.tsFile · 0.85
app.jsFile · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…