How to clone and run vue laravel project with passport? - javascript

currently i need to work on a project using laravel and vue
i cloned the project that i need to work on from github,
the project is using vue and laravel with passport
but i'm not sure what are the commands i need to use to run the project on my local machine
do i follow the same commands like when i clone a laravel project? or there is something extra for vue?
i tried to install passport and run few commands but still facing blank page
if someone can provide the commands in order that would be much appreciate it

It's really difficult to say what commands needs to be run in your specific case, since we can't see the code. Also make sure your .env is set up correctly with database connections etc.
But generally you would need something like this.
Install packages
composer install
npm install
Create APP_KEY for Laravel
php artisan key:generate
Run migrations to create all your database tables.
php artisan migrate
Start artisan server for the Laravel backend. Default port is 8000, so you should reach it at http://localhost:8000
php artisan serve
Compile the front end files
npm run dev
But this is all guesswork. Your project could be set up different.

Related

Hosting NestJS app on Phusion Passenger when hosting provider expects app.js file

I am currently working on a project related to my university and I would like people from my organization to be able to see my progress. My hosting provides the ability to run Node.js server, however it's refering to the app.js file which NestJS project doesn't have as it's being run through the command line (npm run start). Is there any way to run such application, for example by creating an app.js file which would be able to run the command?
Thank you for any assistance with this case.
PS. Server is running Phusion Passenger.
Phusion Passenger error message
If the server expects an app.js file and can't be customized to use something else, then you could have an app.js in your root directory that requires('./dist/main.js') and that's it. This would mean that your hosting service has to build the typescript code to javascript first, but that's hopefully something supported. If it isn't then you can do
// app.js
require('ts-node').register(); // you can pass extra options here
require('./src/main.ts');
It's not something I'd immediately recommend, but it would make the project runnable.

How do I run my react front-end and express back-end together?

I'm attempting to build a simple react/node/express app from scratch (not using the create-react-app). I've built out a simple back end to pass some data to the front end but am having a hard time figuring out how the two communicate. How can I run the front-end and back-end together and view the front-end with the data passed into it?
I'd like to do this all in one command. Do I have to use a tool like webpack to bundle everything together into one runnable package?
My repo can be found here, it is the react-and-express branch that I've linked to. Any help is much appreciated! Currently I'm running the app by starting index.js but that is only the backend, how do I run my front-end App.js and get the two to communicate?
https://github.com/int-a/contacts-application/tree/react-and-express
You can use concurrently to run two node commands at the same time (1 for front-end and 1 for back-end). And then use the proxy configuration in webpack dev server to alias the calls to the backend port number for the same machine.

Hosting simple NPM local server on GitHub gh-pages?

Is it possible to currently host local served content to gh-pages that isn't a framework?
Just simple html, css, and JS files along with API calls.
Currently using a npm package http-server for a simple server.
I attempted using npm gh-pages, however because I am not using a framework, I don't have a build option. Even using the default npm run-script build does not exist. Even so, I read that build is required for C/C++ bindings that causes a requirement for a build process.
gh-pages only serves static content, it doesn't allow server-side hosting.
This is no problem:
simple html, css, and JS files
but this
along with API calls.
is not possible unless you do everything through requests to external servers.

Project structure when using VueJS, VuelidateJS with NodeJS/Express

My web development is principally intranet sites and web front-ends for embedded devices using NodeJS.
My current structure is to have everything in one NPM package. I run NodeJS behind Nginx, and let Nginx serve css/image/client-side-javascript files directly from public.
I'm starting to use VueJS and Vuelidate, both of which use the now ES6 modules system - e.g. import { required, minLength } from 'vuelidate/lib/validators'.
While I've (rather hackily) made these work with my current structure, I think the time has come to get into the world of Javascript build-systems/bundlers.
If I use VueJS's preferred option of WebPack, how should I change the structure of my code?
Should I have one NPM package for the frontend (generated by vue-cli init) and another for the Express backend app?
Should I put my Express App into the generated Vue frontend package?
Should I use browserify to do the job of WebPack and stay with my existing structure?
Or something else entirely?
I’m not sure why you’re intent on putting your JavaScript code in other packages. If you have an application then you can keep your raw JavaScript files in there, along with the build script(s). Someone should be able to check your application out and be able to build it.
If you’re looking to get started with a build system, then a nice “bridge” might be to use Mix, a project created by Laravel for building front-end assets such as Sass and JavaScript. It uses Webpack under the hood, but in turn exposes a more user-friendly, fluid API.
If you go down this route, then you could put your raw JavaScript files in a lib/ or src/ directory. You could then use Mix to compile these components like this:
mix.js('lib/your-entry-point-script.js', 'public/js/app.js');
Your entry point script would just be the script that requires all your other scripts and components and the script that you want “built”. Mix would then compile that and place the resultant script at public/js/app.js.
Mix itself is just a npm package, so all you need to do is npm install laravel-mix --save-dev.
You can read more about Mix at https://laravel.com/docs/5.7/mix

How to upload nodejs project or install nodejs and npm modules on live server

I've made a real time chat application with node and socket io and it is running well in my local machine. But its time to run it on my live windows server. I can't understand to how set it up there. Do I need to upload the files to the server or I've to install node js and npm modules in the server and then upload the files. And how I can do these? How I'll run the command prompt as we do in local machine like node chat.js ? Any help is appreciated.
Thanks in advance.
You can use a deployment client like Capistrano or you can just upload your source files then run npm install (assuming your have node installed) followed by your commands to bring up the server. I'd suggest using a framework like meteor or sails to make deployment easier. Or using a cloud solution like heroku.
You can use Jenkins for deploying your app to server. Running bash commands and setting builds are much more easier.
Keep it simple:
Download and install NodeJS, NPM (here)
You need to establish a simple way to move your files to the remote server. Since you can run your code and do the development at your local machine, I recommend you to use github for this purpose. Set up a repository and clone it at your remote server. Then, you can always push and pull your changes using git.
You need to establish a simple way to run your code at the remote server. Since you use Windows, I recommend you to create a .bat file that does all the preparations and runs your code. In the simplest case, it would contain node path\to\project\chat.js. Then, run this file using a console. If you're going to use github, you probably should include this .bat file to your repository.
Good luck!

Categories

Resources