blog-example

Blog Example

Blog example project with Svelte and svelte-router

Blog-example

Blog example project with Svelte and svelte-router

(from Youtube channel - Classsed - Svelte Tutorial (Better than React?) )

Install

Clone project and install dependencies.

git clone https://github.com/Jarkkohei/blog-example.git
cd blog-example
npm install

Add env.js -file into the root folder of your project and add following code into it, replacing the <YOUR_API_BASE_URL_HERE> with your API base url ( without the trailing / )

This file can be used to also store other constants, although be aware that they will be visible in the bundle.js -file as a plain text.

const env = {
    API_BASE_URL: '<YOUR_API_BASE_URL_HERE>'
};

export default env;

Run the developement server.

npm run dev

Note that you will need to have Node.js installed.

Navigate to localhost:5000. You should see your app running.


Deploying to the web

With now

Install now if you haven't already:

npm install -g now

Then, from within your project folder:

now

As an alternative, use the Now desktop client and simply drag the unzipped project folder to the taskbar icon.

With surge

Install surge if you haven't already:

npm install -g surge

Then, from within your project folder:

npm run build
surge public

Top categories

Loading Svelte Themes