An Example of running an express.js api using with @common-web utils. Leverage latest babel + typescript features in your api.
- @common-web/rollup (bundler)
- @common-web/babel (transpiler)
- @common-web/ts-config (ts-config)
- @common-web/prettier (prettier)
- @common-web/lint-staged (lint-staged)
- nodemon (watch mode)
- Installation
yarn install
- Commands (run server static or in watch mode)
// Build src files (index.ts) into dist/index.js
yarn run build
// runs the server
yarn run run-server
// runs the server in watch mode
yarn run watch-server
- Test out API
Request:
curl http://localhost:3000/api/test | jq
Response:
{
"data": [
{
"name": "Bob",
"age": 32
},
{
"name": "Judy",
"age": 33
},
{
"name": "Jill",
"age": 28
},
{
"name": "Sally",
"age": 22
}
]
}