![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
expresso-machine
Advanced tools
expresso-machine is cli app which generates a full express js application, including api endpoints, database/sequelize initial migrations, seeders, modules. It also create a dockerfile and docker-compose adjusted to the database dialect set.
Expresso-machine is a CLI utility to generate an express js app featuring:
As expresso-machine dockerizes the generated expressjs app, it would be beneficial to have the docker and docker-compose commands installed in your machine. In windows environents when working with bash I suggest using Window's Power Shell
npm install -g expresso-machine
This will install the cli expresso command at global level. Once the installation process completes run the following command:
expresso-machine -h
You should get the following output or similar:
Usage: expresso-machine -i my-app l- product,category
Options:
-V, --version output the version number
-i, --init <projectname> Creates a project named <projectname> (default: "my-app")
-p, --port [port] Set the port the node app is exposed on [port] (default: 3000)
-P, --dbport [dbport] Set the port database is exposed on [dbport] (default: 5433)
-o, --overwrite Overwrite project folder if already existing
-d, --dbDialect [dbDialect] Enter the database [dbDialect] you would like to use: postgres, sqlite, mssql or mysql (default: "postgres")
-l, --list <apiEndpoints> A list of api properties <apiEndpoints>, comma-separated (default: ["product","category"])
-h, --help output usage information
At this point you are ready to start generating express js apps! Take a look at the following example command to run:
expresso-machine -i my-app -l dog,cat
This command will create a 'my-app' folder with a ready to run dockerized application. CD into the folder:
cd my-app
Run the following command as a background process:
npm run init &
This command will run docker-compose build and the overall app. Wait until this process completes in the background. When it does run:
npm run init-db
This will create a sequelize migration and create the Dog, Cat tables as well as the seeding process to create a record for each table.
The application exposes the following endpoints on default port 3000:
GET localhost:3000/dogs/ (all paginated dogs)
GET localhost:3000/dogs/:id (get a dog with id <:id>)
POST localhost:3000/dogs/ (create a dog, you must include the 'dog' object in the request body)
PUT localhost:3000/dogs/:id (update a dog, you must include the 'dog' object in the request body and 'id' <:id>)
DELETE localhost:3000/dogs/:id (delete dog with 'id' :id)
GET localhost:3000/cats/ (all paginated cats)
GET localhost:3000/cats/:id (get a cat with id <:id>)
POST localhost:3000/cats/ (create a cat, you must include the 'cat' object in the request body)
PUT localhost:3000/cats/:id (update a cat, you must include the 'cat' object in the request body and 'id' <:id>)
DELETE localhost:3000/cats/:id (delete cat with 'id' :id)
Once you seed the db an user is created with the following credentials:
You can use POSTMAN or another REST client to post to the credentials to the /auth/login endpoint. I.e.
Run the request and get the token:
Copy the the token and include it in an authorization header key and hit the GET endpoints to return all 'cats' (i.e. http://localhost:3000/cats) and get a seeded record as generated by expresso-machine:
When you install expresso-machine another command will be made available globally: expresso-machine-add-api-endpoints or em-add-api-endpoints
Check it out:
em-add-api-endpoints -h
Usage: expresso-machine-add-api-endpoints l- product,category
Options:
-V, --version output the version number
-l, --list <apiEndpoints> A list of api properties <apiEndpoints>, comma-separated (default: [])
-h, --help output usage information
Use this command when you cd into a project folder generated by expresso-machine
cd my-app
Then run the expresso-machine-add-api-endpoints command followed by the -l option with a comma-separated list of endpoint domains to add to your project i.e.
expresso-machine-add-api-endpoints -l
expresso-machine will generate the following files within the my-app project directory:
./src/routers/route-products.js ./src/routers/route-categories.js ./src/db/models/product.js ./src/db/models/category.js ./src/db/seeders/20190305001941-product-data.js ./src/db/seeders/20190305002041-category-data.js ./src/db/migrations/20190305001941-create-product.js ./src/db/migrations/20190305002041-create-category.js
./index.js will also be amended so the route will be added.
docker-compose build && docker-compose up
to install project dependencies and create docker containers and starts themdocker-compose build
docker-compose up
docker exec -it my-app_web_1 ./node_modules/.bin/sequelize db:migrate:undo:all
from host OS into container and undoes SEQUELIZE migrationdocker exec -it my-app_web_1 ./node_modules/.bin/sequelize db:migrate
from host OS into container and generates SEQUELIZE migrationdocker exec -it my-app_web_1 ./node_modules/.bin/sequelize db:seed:all
from host OS into container and performs SEQUELIZE database seed operationdocker exec -it my-app_web_1 /bin/ash
to log into the docker container via shell* Adding a facility to the **expresso-machine** to also add templates (i.e. nunjucks or other template engines) and an extra CLI to add extra routes & templates.
FAQs
expresso-machine is cli app which generates a full express js application, including api endpoints, database/sequelize initial migrations, seeders, modules. It also create a dockerfile and docker-compose adjusted to the database dialect set.
The npm package expresso-machine receives a total of 4 weekly downloads. As such, expresso-machine popularity was classified as not popular.
We found that expresso-machine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.