This directory shows examples of Connect for Node.js using the http
package from Node.js
To start the server, run npm start
Once a server is started, there are multiple variations of clients to interact with it.
By default, the http
server also serves the frontend Eliza interface. Visit http://localhost:3000
to view it in a browser. This is a full-stack example using Connect for Web.
Run npm run client
to start a terminal client using Connect for Node.js.
To see the CORS setup in action, run npm start 3001
and then visit http://localhost:3001
in a browser. The browser client will send requests to localhost:3000,
triggering CORS.
This example comes with tests. We are using the Node.js built in test runner to show different approaches to testing, from integration tests with a full HTTP server to unit tests.
Run npm test
to run all tests.
- connect.test.ts shows testing a service.
- client.test.ts shows testing a client application.
Run npm run generate
to generate the compiled protos via Protobuf-ES.