intro to vue js code example
Example 1: create vue project
npm install -g @vue/cli
//then
vue create hello-world
Example 2: vue js tutorial
//Best project Tutorial i have seen
https://www.youtube.com/playlist?list=PL55RiY5tL51qxUbODJG9cgrsVd7ZHbPrt
Example 3: how to integrate vuejs with nodejs and express
const Joi = require('joi');
const db = require('./connection');
const schema = Joi.object().keys({
username: Joi.string().alphanum().required(),
subject: Joi.string().required(),
message: Joi.string().max(500).required(),
imageURL: Joi.string().uri({
scheme: [
/https?/
]
})
});
const messages = db.get('messages');
function getAll() {
return messages.find();
}
function create(message) {
if (!message.username) message.username = 'Anonymous';
const result = Joi.validate(message, schema);
if (result.error == null) {
message.created = new Date();
return messages.insert(message);
} else {
return Promise.reject(result.error);
}
}
module.exports = {
create,
getAll
};