Skip to content

Commit

Permalink
refactor express-hello-world
Browse files Browse the repository at this point in the history
  • Loading branch information
joelnet committed Oct 3, 2018
1 parent 821cf38 commit eaa7091
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions examples/express-hello-world/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ import pipe from 'mojiscript/core/pipe'
import tap from 'mojiscript/function/tap'
import $ from 'mojiscript/string/template'

const defaultRoute = () => res => res.send ('Hello World')
const startExpress = express => ({ port }) => express.listen (port)
const setupRoutes = express => pipe ([
() => express.get ('/') (defaultRoute)
// selectors
const getPort = ({ port }) => port

// routes
const defaultRoute = () => ({ send }) => send ('Hello World')

// express
const setupRoutes = ({ get }) => pipe ([
() => get ('/') (defaultRoute)
])
const startExpress = ({ listen }) => pipe ([
getPort,
listen
])

const main = ({ express, logF }) => pipe ([
Expand Down

0 comments on commit eaa7091

Please sign in to comment.