generated from formidablejs/formidablejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server
39 lines (35 loc) · 1.04 KB
/
server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
/**
* This file is the entry point for the server. It is responsible for
* starting the server and listening for requests.
*
* Avoid modifying this file unless you know what you are doing.
*/
const { Server } = require('@formidablejs/framework')
/**
* The .start method will start the server and listen for requests.
*
* You can pass an object with the following properties:
* - port: The port to listen on. Defaults to 3000.
* - host: The host to listen on. Defaults to 'localhost'.
* - _: A callback function that will be called when the server is ready.
* This callback will receive an error object as the first argument
* and the address as the second argument.
*
* @example
* // Start the server on port 3000
* .start({
* port: 3000,
* host: 'localhost',
* _: (err, address) => {
* if (err) {
* console.error(err)
* process.exit(1)
* }
* console.log(`Server listening on ${address}`)
* }
* })
*/
Server
.use(require('./.formidable/build').default)
.start()