m.mikolajczak
m.mikolajczak

Reputation: 124

How attach server-side node script to nuxt.js application with auto run just after "nuxt start"?

I need to create server side API in Nuxt.js app. It'll be a standalone service and I have to initiate some actions right after server start, before any client request. I guess that I have to create custom start script with triggering "nuxt start" and my actions, right? How should it looks like?

Upvotes: 0

Views: 993

Answers (1)

kusiaga
kusiaga

Reputation: 695

I am not sure but your package.json script will probably look like this.

{
  "start": "nuxt start && cd ../server-api && <command to run server api>"
}

but I think this is not a good practice to implement frontend and backend relations like this.

But if you want to make the frontend and api in one bundle, perhaps you can check backpackjs https://github.com/jaredpalmer/backpack

Upvotes: 1

Related Questions