GithubHelp home page GithubHelp logo

danirod / danirod.dev Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 2.72 MB

I made a new professional website to let people know that I write code in exchange of money. Now with handcrafted HTML.

Home Page: https://danirod.dev

License: GNU Lesser General Public License v3.0

CSS 3.81% Vue 70.68% TypeScript 25.51%
nuxt portfolio unocss

danirod.dev's Introduction

GitHub deployments

A screenshot of the site

danirod.dev

Yes, I made a new portfolio website for my freelance services. Features include:

  • Not based on WordPress (I guess that is a feature for some).
  • Multilingual, serves content both in English and in Spanish.
  • New domain, to keep the SEO clean (danirod.es can be a digital garden again).

Powered by Nuxt 3 and UnoCSS.

Commands

  • Setup: npm install
  • Run the server: npm run dev
  • Build the app: npm run build
  • Test in production: npm run preview

Development notes

Contact form

It uses an integration against Mailgun. There is a server endpoint in /server/api/contact.post.ts which will receive the payload from the contact form and deliver it via their REST API. Here are some important remarks.

Non-XHR fallback

It is important that the contact form does content negotiation, period. I've seen a couple of times an unhandled exception inside the Nuxt internals that causes all the JavaScript of the site to stop working and handling events, so this is a real threat.

Pressing "Send" and not having the form submitted is unacceptable, which means that the form requires proper action and method parameters so that if the JavaScript event handler fails, it does a standard HTTP POST submit like in the good old times.

It is important that the AJAX request sets the Accept header to application/json, because that is what the backend endpoint will use to detect if this is a XHR request or not. XHR requests will receive a JSON body as this is what the Accept header asks. If it's not an XHR request, the endpoint will 302 to contact/success.vue, which presents a fairly traditional and boring confirmation message.

Environment

The following four environment variables must be declared and present:

  • MAILGUN_API_KEY: An API key to use Mailgun's REST API in order to deliver contact forms.
  • MAILGUN_API_DOMAIN: The domain to use when sending an e-mail. Might be danirod.dev, might be the sandbox domain.
  • MAILGUN_API_FROM: Just a way to parameterize the email to show in the From header, usually [email protected], but not hardcoded anyway.
  • MAILGUN_API_TO: Just a way to parameterize the email where the contact form will be delivered, usually my business mail, but not hardcoded anyway.
  • MAILGUN_API_ENDPOINT: Set to https://api.eu.mailgun.net when Mailgun is configured to use European servers, otherwise it will return HTTP 401.

i18n

Situation:

Additional requirements (should be covered by nuxt-i18n but it is important to take a look):

  • Make sure that the html tag has the proper lang="" attribute.
  • Make sure that there are hreflang references in the head.

danirod.dev's People

Contributors

danirod avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.