Ukusingathwa kwamahhala kweNode.js noHeroku

Ukusingathwa kweNode.js akukasakazeki kakhulu, ikakhulukazi emazweni akhuluma isiJalimane. Inkampani yamafu yaseMelika iHeroku inikeza isisombululo lapha - futhi nangaphandle kwenkokhiso . Uhlala uqaphela umbono wokuthi "Yakha izinhlelo zokusebenza ... hhayi ingqalasizinda" futhi usenemikhawulo. Njengesibonelo, sisebenzisa umsebenzi omncane we-cron osuselwa ku- PhantomJS , esusa iwebhusayithi nsuku zonke futhi ithumele isihloko sekhasi nge-imeyili.


Ukuze senze lokhu, siqala ukubhalisa mahhala ku- https://signup.heroku.com/:

Ukusingathwa kwamahhala kweNode.js noHeroku

Ngemuva kokuqinisekiswa okuyisibopho kwe-imeyili, sizokhipha iphasiwedi evikelekile:

Ukusingathwa kwamahhala kweNode.js noHeroku

Ukuze sikwazi ukusebenzisa izengezo zamahhala ezivela eMakethe ngokuhamba kwesikhathi, kufanele siqinisekise i-akhawunti yethu ngaphansi kwe- https://heroku.com/verify ngokufaka ikhadi lesikweletu (ungakhathazeki, konke kuhlala kumahhala):

Ukusingathwa kwamahhala kweNode.js noHeroku

Konke okunye manje kwenzeka kuphela kulayini womyalo. Ngalokhu sidinga endaweni yangakini iNode.js / npm , Git neHeroku CLI .

Ukusingathwa kwamahhala kweNode.js noHeroku

Ekugcineni singena kuHeroku endaweni (kanye) kulayini womyalo:

Ukusingathwa kwamahhala kweNode.js noHeroku

Okokuqala sakha uhlelo lokusebenza olusha olususelwa ku- buildpack efanelekile. Esibonelweni sethu sisebenzisa i-Node.js esemthethweni yokwakha i-heroku-buildpack-nodejs.git:

1a01abaf4b9308c5714622396ccc4708

Manje sakha iphakethe.json ukufaka amaphakheji we- PhantomJS , CasperJS , SpookyJS kanye neNodemailer adingekayo kuphrojekthi yethu:

1a01abaf4b9308c5714622396ccc4708

Umqondo wangempela ungatholakala kuscript.js:

1a01abaf4b9308c5714622396ccc4708

Okokuqala sihlola konke endaweni:

1a01abaf4b9308c5714622396ccc4708

Iskripthi sikhipha isihloko kuwebhusayithi bese sithumela i-imeyili:

Ukusingathwa kwamahhala kweNode.js noHeroku

Manje sicindezela yonke into kuHeroku, nayo ebangela inqubo yokwakha:

1a01abaf4b9308c5714622396ccc4708

Uma ufuna ukuphusha izinguquko zekhodi kuHeroku kamuva, umane uPhusha futhi. Ngakolunye uhlangothi, manje sesingahlola nge-SSH ukuthi ngabe konke kusebenza kwiseva:

1a01abaf4b9308c5714622396ccc4708

Nalapha futhi, i-imeyili ithunyelwa kahle. Manje kufanele sisebenzise inqubo ngokuzenzakalelayo:

1a01abaf4b9308c5714622396ccc4708

Sifaka ikholi yeskripthi entsha ngo- "Faka umsebenzi omusha":

Ukusingathwa kwamahhala kweNode.js noHeroku

Njengokuhlolwa, sikhetha yonke imizuzu eyi-10 njengokuvama bese siyakugcina:

Ukusingathwa kwamahhala kweNode.js noHeroku

I-cronjob manje isizokwenza umsebenzi wayo ngokuzenzakalela ngokuzayo.

Emuva