A simplified Express.js environment to serve server + client code.
yarn add @arundo/adk-express
/* import un-instantiated express app from our starter kit...
this is a full-fledged express app, ready to accept middleware,
plugins, routers, etc. We've added the .start() method to fire
up the server directly, although you could always start it any other way
you like.
*/
import express from '@arundo/adk-express'
const app = express()
app.start({
useClient: true, // defaults to true to route all paths to client-side index.html
}) // custom start() method, launches http listener
Env vars supported:
PORT=3000
NODE_ENV=production
import express from '@arundo/adk-express'
import api from './api'
const app = express()
app.use('/api', api)
app.start() // custom start() method, launches http listener
import express from 'express'
const app = express()
// example route... will be callable from /api/foo
app.get('/foo', (req, res) => {
res.json({
success: true,
path: req.path,
})
})
export default app