Microtalk Server

We create a small express server that can evaluate microtalk server-side.

Begin by installing node for server-side javascript. site

Then unzip microtalk-server to get three files. zip

- microtalk.js with a module.export added. - index.js web server that runs microtalk. - package.json instructions for installing and starting.

Here is index.js which uses express for routing. site

const express = require('express') const microtalk = require('./microtalk.js') const app = express() app.get('/', function (req, res) { res.send('microtalk') }) app.get('/eval/:expr', function (req, res) { var expr = req.params.expr result = microtalk.evaluate(expr) res.send(result.val) }) app.listen(4444, function () { console.log('listening on port 4444') console.log('try http://localhost:4444/eval/{lib}') })

Use node package manager (npm) to install the rest.

Use npm to start the server.

Visit the microtalk server at http://localhost:4444

The server is a running program that keeps its bindings until stopped. For example, try these in any order.

See Testing Microtalk for other experiments.