https://github.com/trco/express-vue
Express & Vue
https://github.com/trco/express-vue
Last synced: 5 months ago
JSON representation
Express & Vue
- Host: GitHub
- URL: https://github.com/trco/express-vue
- Owner: trco
- Created: 2019-06-18T19:53:29.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T00:51:39.000Z (over 3 years ago)
- Last Synced: 2025-04-02T21:35:06.665Z (about 1 year ago)
- Language: JavaScript
- Size: 2.91 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 27
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
===============
Express & Vue
===============
Express backend & Vue frontend
Run
===
Run docker and visit http://localhost:8080::
$ docker-compose up
How to build it from scratch?
=============================
1. Create project folder::
$ mkdir express-vue
$ cd express-vue
2. Create Express backend app, install dependencies::
$ express back
$ cd back
$ npm install
3. Change default port from ``3000`` to ``8000`` in ``bin/www``.
4. Enable CORS in Express using following middleware::
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
5. Install ``vue client``::
$ npm install -g @vue/cli
6. Create Vue frontend app in project folder, install dependencies::
$ vue create front
7. Fetch data from Express backend through "http://localhost:8000/" inside .vue files.
8. Create separate ``Dockerfile`` in back and front apps and ``docker-compose.yml`` in project folder.