How To Run This Code on localhost?


#1

https://scotch.io/tutorials/how-to-build-a-simple-single-page-application-using-vue-2-part-1

I just download the code inside the folder that i created which is ‘projects’. but why it is blank once i open it? I am using wamp.

http://localhost/projects


#2

I think what you are missing is that you have to build the app npm run build and then use the new build folder on wamp


#3

let say i have a folder named todo. after i run npm run build, i will just copy the todo folder on my root wamp folder. but why after opening localhost/todo. it is blank?


#4

If your project is named /todo/, then the result of your build process is in /todo/dist folder, and this is the folder you have to deploy.

Also, if you want to serve the project under a localhost/todo subpath instead of localhost/ (root path) you have to let vue-router know that:

const router = new VueRouter({
  routes, // short for routes: routes
  mode: 'history',
  base: '/todo'
})